Tuesday, 29 March 2016

Open Report with selected record in ax 2009 X++


Write the below code on click method of button from where you want to open report.
void clicked()
{
Args args;
ReportRun reportRun;
;
args = new Args();
args.name(Reportstr(S3WorkOrderReportMain));
args.parm(salesLine.SalesId);
args.record(salesLine);
args.parmObject( args );
reportRun = classfactory.reportRunClass(args);
reportRun.init();
reportRun.run();
}
and on report init() method wriite the below code.
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();
}
set interaction property for report and query –    NO

No comments:

Post a Comment