Contact Me

Total Pageviews

Tuesday 5 August 2014

Run a Report from a Class in Axapta

Hi all,

There are several methods to run a Report Directly from a Class:

Method1 : Create a Class and write the following code in 'main()' method..

static void main(Args  args)
{ ReportRun reportRun;
  Args      args = new Args(reportstr('CustTransList'));
;
reportRun = new Reportrun(args);
reportRun.init();
reportRun.run();
}


Method2 : 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 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 <xpp>

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

public identifiername lastValueElementName()
{
 return reportstr("CustTransList");

}

Happy Daxing! :)


No comments:

Post a Comment