To print the Report from the form
On the Button Clicked method:
void clicked()
{
Args args = new args();
ReportRun reportRun;
report r;
//SysQueryRun sysqueryrun;
;
args.parm(inventtransfertable.TransferId);
args.name(reportstr(BranchOrderRequistion));
reportRun = new reportRun(args);
reportRun = classFactory.reportRunClass(args);
reportRun.suppressReportIsEmptyMessage(false);
reportRun.query().interactive(false);
r = reportrun.report();
r.query().interactive(false);
reportrun.init();
reportrun.run();
// super(); /// disable the error code(Object 'ReportRun' could not be created in ax 2009).
}
And then on the init method on the report;
public void init()
{
Args args = new args();
ReportRun reportrun;
if(element.args().parm())
{
this.query().dataSourceTable(tablenum(inventtransfertable))
.addRange(fieldnum(inventtransfertable, TransferId)).value(element.args().parm());
// this.query().userUpdate(false);
this.query().interactive(false); // disables query prompt
this.report().interactive(false); // disables report promt(printer setting)
}
else
{
//args.parm(inventtransfertable.TransferId);
//args.name(reportstr(BranchOrderRequistion));
reportrun = new ReportRun(args);
reportrun.query().interactive(false);
// reportrun.init();
// reportrun.run();
}
this.printJobSettings().suppressScalingMessage(true); //disables page size window
// super();
}
No comments:
Post a Comment