Contact Me

Total Pageviews

Sunday 3 August 2014

Pass Parameters Between a Form and a Report in Axapta

"Args" class will be used.

Override the Clicked() method of the button on the form like this:

void clicked()
{
   Args         args;
   ReportRun    reportRun;
   ;
   super();
   args = new Args();
   args.name(Reportstr(CustomerTransactions));
   args.record(CustTable);    //CustTable is the Datasource of the Form
   reportRun = classfactory.reportRunClass(args);
   reportRun.init();
   reportRun.run();
   reportRun.wait();
}

Override "init()" method of the report:

public void init()
{
  if(element.args().record())
  {
    extCustTable = element.args().record();

  }
}

Override "Fetch" method:

public boolean fetch()
{

boolean ret;

if(extCustTable)  //Launched from the form for a selected record
{
       this.query().datasourcetable(CustTable).addRange(CustTable,AccountNum).value(extCustTable.Acc ountNum)  
//Run the CustTrans Report for the selected Account Number on "CustTable" form.            
}

ret=super();
return ret;
}

No comments:

Post a Comment