After you created your report in AX you can call report from AX form by follow the below steps:
1- Create menu item with type output by drag and drop report to MenuItems nodes under AOT.
2- Open the form that you need to call report from.
Note: the form should be have dataSource with the table in report
3- Drag and Drop menu Item created in step 1 in the form under any button group.
4- Add the following method to Report
void initFromCaller(Args _args)
{
str QrderId; // field used as Rang and used to filter data
QueryBuildDataSource qbds; // should be represent report datasource and selected record in the form
;
if (! _args ||
! _args.caller() ||
_args.dataset() != tablenum(TableName) )
return;
QrderId = _args.record().(fieldnum(TableName,FieldName));
qbds = element.query().dataSourceTable(tablenum(TableName));
if(!qbds.findRange(fieldnum(TableName,FieldName)))
{
qbds.addRange(fieldnum(TableName,FieldName)) ;
}
qbds.findRange(fieldnum(TableName,FieldName)).value(queryvalue(QrderId));
}
No comments:
Post a Comment