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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 03.08.2008, 20:10   #1  
Blog bot is offline
Blog bot
Участник
 
25,640 / 848 (80) +++++++
Регистрация: 28.10.2006
axaptapedia: RunBaseReport
Источник: http://www.axaptapedia.com/RunBaseReport
==============

Summary:

The RunBaseReport class is part of the RunBase Framework. Its main purpose is to provide a user interface before the report starts and pack business logic. The RunBaseReport class addresses the issue that there is no inheritence for reports in Dynamics AX. But Dynamics AX supports inheritence for classes. So you can pack business logic in a RunBaseReport class and reuse it for serval reports.

[[Image:Runbasereport_dev.png]]

==Class Methods==
The RunBaseReport class has a lot of methods to define and change the behaviour. Create a new class and extend the RunBaseReport class. At least two methods have to be changed to make the class work

* main
* lastValueElementName

The main method makes the class runable from an action menu item. The lastValueElementName returns the name of the report to be started. The framework uses the query from the report

public static void main(Args _args)
{
ReportDemo demo = new ReportDemo();
;
if(demo.prompt()) demo.run();
}



public identifiername lastValueElementName()
{
return reportstr(MyReport);
}


The RunBaseReport supports user interaction. To provide a user interface and process user input it is necessary to override four methods

* ClassDeclaration
* dialog
* getFromDialog
* Parameter method

Define a property field in the class declaration and a DialogField element in the class declaration.

class ReportDemo extends RunBaseReport
{
NoYes showSum;
DialogField fieldShowSum;
}


The dialog class modifies the default dialog by adding a dialog field

public Object dialog(DialogRunbase dialog, boolean forceOnClient)
{
Dialog dlg;

dlg = super(dialog, forceOnClient);
fieldShowSum = dlg.addField(typeId(NoYes),"Show sum total");

return dlg;
}


The dialog field contains the selected value. The getFromDialog method is used to get the selected value and set the property value. The example is trivial but there may be situations where you have to do some logic to transform user selection in usefull property values.

public boolean getFromDialog()
{
boolean ret;

ret = super();
showSum = fieldShowSum.value();

return ret;
}


All class fields in Dynamics AX cannot be accessed from outside. Create a parameter method to make the field readable


// Show sum total field on report
public NoYes parmShowSum()
{
;
return showSum;
}


After this modifications the class will look like this

[[Image:Runbasereport_demo1.png?]]

==Report Methods==

After pressing the OK button the report starts. The report can determine who called it and make use of the RunBaseReport class and its properties. Do use the class from the report declare a object reference in the class declaration and change the init method


public class ReportRun extends ObjectRun
{
ReportDemo demo;
}



public void init()
{
;
super();

if(element.args() && element.args().caller() &&
classIdGet(element.args().caller()) == classNum(ReportDemo))
{
demo = element.args.caller();
sumTotals.visible(demo.parmShowSum());
}
else
{
throw error("Report must be called using ReportDemo");
}
}


[[Category:Report development]]


Источник: http://www.axaptapedia.com/RunBaseReport
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
axcoder: PowerShell + Ax Blog bot DAX Blogs 1 09.01.2009 18:05
axaptapedia: Load Web Documents Blog bot DAX Blogs 1 03.01.2009 23:50
axcoder: AxPath is supported by axaptapedia Blog bot DAX Blogs 0 11.05.2007 10:00

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

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

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 06:53.