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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 09.08.2019, 21:20   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
stoneridgesoftware: UI Builder Class Not Using the Same Contract as Controller and DP Classes in Dynamics AX 2012
Источник: https://stoneridgesoftware.com/ui-bu...amics-ax-2012/
==============

The other day I had to convert a custom query-based SSRS report within Dynamics AX 2012 into a regular report so that we could run the report from a different form (ProdTable & ProdTableListPage) and have certain values auto-populate the query prompt. Normally something like this would be easy to implement, however, I ran into some issues when making the modifications.

I created the data provider, Contract and Controller classes, and the dialog values were not changing. I ended up building a UI Builder class as well to counteract this issue. I had the logic to pre-populate the contract in the controller class by using the record that was highlighted, and I verified that the values were being pulled into the contract class as desired. I then stumbled across the issue of the UI Builder class was not using the same contract instance as the Controller & Data Provider classes. This was resulting in the values not populating the prompt and were not being passed to the Data Provider class. What I wound up having to do is to move my logic into the UI Builder class. Below I have the code I had to do in order to utilize this.

Controller main method:

public static void main(Args _args){ SSI_DemoController controller = new SSI_DemoController(); SSI_DemoContract contract = new SSI_DemoContract(); controller.parmReportName(ssrsReportStr(SSI_DemoReport, Report)); controller.parmArgs(_args); controller.parmShowDialog(true); controller.parmShowReportViewerParameters(false); controller.startOperation();}The rest of the logic had to be put into the UI Builder class, specifically the build method

public void build(){ DialogField dlgItem; Args args; ProdTable prodTable; SRSPrintDestinationSettings printSettings; controllerDlg = this.controller(); contract = this.dataContractObject(); args = controllerDlg.parmArgs(); controllerDlg.parmReportContract().parmRdpContract(contract); if(args.record() && args.record().TableId == tableNum(ProdTable)) { prodTable = args.record(); contract.parmItemId(prodTable.ItemId); contract.parmNumberOfCopies(prodTable.QtyCalc); } printSettings = controllerDlg.parmReportContract().parmPrintSettings(); printSettings.printMediumType(SRSPrintMediumType::Printer); if(contract.parmNumberOfCopies() != 0) { printSettings.overridePageSettings(true); printSettings.overridePrintContractSettings(true); printSettings.numberOfCopies(contract.parmNumberOfCopies()); } dlgItem = this.addDialogField(methodStr(SSI_DemoContract,parmItemId),contract); dlgItem = this.bindInfo().getDialogField(contract,methodStr(SSI_DemoContract,parmItemId));}This code was able to solve the issue I was having and should help you if you’re facing the same problems. Learn more about Dynamics AX 2012 by subscribing to our blog and check out our events page for upcoming webinars and training opportunities. If you have any questions in the meantime, please reach out to the experts at Stoneridge Software.



Источник: https://stoneridgesoftware.com/ui-bu...amics-ax-2012/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
ax-erp: Duplicate SSRS reports [Dynamics AX 2012] Blog bot DAX Blogs 0 18.07.2012 19:11
Опции темы Поиск в этой теме
Поиск в этой теме:

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

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

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

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