Interview Questions

Wednesday, May 14, 2014

Based on the current record run the report in ax 2009

Based on the current record run the report in ax 2009


1- write the following code on clicked event on button
void clicked()
{
    Args args;
    ReportRun reportRun;
    ;
    //breakpoint;
    args = new Args();
    args.name(Reportstr(WorkOrderReportMain));
    args.parm(salesLine.SalesId);
    args.record(salesLine);
    args.parmObject( args );
    reportRun = classfactory.reportRunClass(args);
    reportRun.init();
    reportRun.run();

}
2-write logic on report init method:
public void init()
{
    if( element.args())
    {
       SalesLine.SalesId =  element.args().parm();
       salesLine = element.args().record();
       this.query().dataSourceNo(1).addRange(fieldnum(SalesLine,SalesId)).value(SalesLine.SalesId);
   }
    super();
}

No comments:

Post a Comment