AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
DAX
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 19.01.2021, 23:12   #1  
Blog bot is offline
Blog bot
Участник
 
23,925 / 805 (74) +++++++
Регистрация: 28.10.2006
a33ik: RPD and Query (DateFrom, DateTo) based SSRS report, AX classes
Источник: http://daxonline.org/1715-rpd-and-qu...x-classes.html
==============

Contract class:
[ DataContractAttribute]class VKSalesQuotationDailyContract extends SrsReportRdlDataContract implements SysOperationValidatable{ TransDate dateFrom; TransDate dateTo; NoYes showDetails; [ DataMemberAttribute('dateFrom'), SysOperationLabelAttribute(literalStr("@SYS35369")), SysOperationControlVisibilityAttribute(true) ] public TransDate parmDateFrom(TransDate _dateFrom = dateFrom) { dateFrom = _dateFrom; return dateFrom; } [ DataMemberAttribute('dateTo'), SysOperationLabelAttribute(literalStr("@SYS114982")), SysOperationControlVisibilityAttribute(true) ] public TransDate parmDateTo(TransDate _dateTo = dateTo) { dateTo = _dateTo; return dateTo; } [ DataMemberAttribute('ShowDetails'), SysOperationLabelAttribute(literalStr("@SYS8811")), SysOperationControlVisibilityAttribute(true) ] public NoYes parmShowDetails(NoYes _showDetails = showDetails) { showDetails = _showDetails; return showDetails; } /// /// Validates the parameters. /// /// /// true if successful; otherwise, false. /// public boolean validate() { boolean isValid = true; if(!this.parmDateFrom()) { error("Date from is mandatory"); isValid = false; } if(this.parmDateFrom() && this.parmDateTo()) { // Check whether FromDate is greater than ToDate or not if (this.parmDateFrom() > this.parmDateTo()) { error("@SYS91020"); isValid = false; } } return isValid; }}Controller class:
class VKSalesQuotationDailyController extends SrsReportRunController{ public static VKSalesQuotationDailyController construct() { return new VKSalesQuotationDailyController(); } public static void main(Args _args) { VKSalesQuotationDailyController salesQuotationDailyController = VKSalesQuotationDailyController::construct(); salesQuotationDailyController.parmReportName(ssrsReportStr(VKSalesQuotationDailyBookingR, Report)); salesQuotationDailyController.parmArgs(_args); salesQuotationDailyController.parmDialogCaption("Sales quotation daily bookings"); salesQuotationDailyController.startOperation(); } protected void prePromptModifyContract() { VKSalesQuotationDailyContract contract = this.parmReportContract().parmRdpContract(); // Set the report design name. this.parmReportContract().parmReportName(ssrsReportStr(VKSalesQuotationDailyBookingR, Report)); } /// /// Modifies the contract before the report is run. /// protected void preRunModifyContract() { VKSalesQuotationDailyContract contract = this.parmReportContract().parmRdpContract(); date fromDate = contract.parmDateFrom(); date toDate = contract.parmDateTo(); Query query = this.getFirstQuery(); // Modify the query contract based on fromDate & toDate. SrsReportHelper::addFromAndToDateRangeToQuery(query, fromDate, toDate, tableNum(SalesQuotationTable), fieldNum(SalesQuotationTable, CreatedDateTime)); }}
Data provider class:
[ SRSReportParameterAttribute(classStr(VKSalesQuotationDailyContract))]class VKSalesQuotationDailyDP extends SRSReportDataProviderPreProcessTempDB{ VKSalesQuotationDailyHeaderFooter salesQuotationDailyHeaderFooter; VKSalesQuotationDailyContract contract; [SRSReportDataSetAttribute(tablestr(VKSalesQuotationDailyHeaderFooter))] public VKSalesQuotationDailyHeaderFooter getSalesQuotationDailyHeaderFooter() { select salesQuotationDailyHeaderFooter; return salesQuotationDailyHeaderFooter; } /// /// Process report data. /// public void processReport() { contract = this.parmDataContract() as VKSalesQuotationDailyContract; // Populate report header / footer information this.populateSalesQuotationDailyHeaderFooter(); } protected void populateSalesQuotationDailyHeaderFooter() { CompanyInfo companyInfo = CompanyInfo::find(); salesQuotationDailyHeaderFooter.CompanyName = companyInfo.name(); salesQuotationDailyHeaderFooter.DateFrom = contract.parmDateFrom(); salesQuotationDailyHeaderFooter.DateTo = contract.parmDateTo(); salesQuotationDailyHeaderFooter.ShowDetails = contract.parmShowDetails(); salesQuotationDailyHeaderFooter.insert(); }}Output menu item:
Temporary table (VKSalesQuotationDailyHeaderFooter) should be Table Type = TempDB
Create/Prepare a Query in AOT
Add the query as dataset to SSRS report. Set Dynamic Filters property to True in properties of Query dataset:

If changing the property to "True" you are facing with "The number of defined parameters is not equal to the number of cell definitions in the parameter panel." error, you will have to fix it manually (follow the link).
Add data provider dataset tp the report:

Report dialog:


Источник: http://daxonline.org/1715-rpd-and-qu...x-classes.html
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
a33ik: RPD based SSRS report with Query (DateFrom, DateTo), AX classes Blog bot DAX Blogs 0 19.01.2021 16:12
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 09:35.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.