I am currently on AX 2012 R2. I currently have a custom query object in the AOT that I am using to supply data to a custom SSRS report.
In the SalesTable form, I have a custom button on the SalesTable form in which I overridden the clicked method to call out to a custom Output Menu Item, to supply parameters of SalesTable.CustAccount and SalesTable.SalesId.
However, when I select another record on the SalesTable form and click the custom button, the query dialog displays (dialog for selecting exact values) as normal, but the last selected values for my parameters are still intact. I assume due to usage data.
With creating SSRS reports with Queries, is there a way supply the current selected record values from a form to the dialog as parameters, rather than what is held in usage data?
Please advise and thanks in advance
void clicked()
{
MenuFunction jobCardReport;
Args args = new Args();
Query query = new Query();
QueryRun queryRun;
QueryBuildDataSource qbds;
QueryBuildRange queryBuildRange;
SalesTable salesTableRecord;
;
salesTableRecord = element.args().record();
qbds = query.addDataSource(tableNum(SalesTable));
queryBuildRange = qbds.addRange(fieldNum(SalesTable, CustAccount));
queryBuildRange.value(salesTableRecord.CustAccount);
queryBuildRange = qbds.addRange(fieldNum(SalesTable, SalesId));
queryBuildRange.value(salesTableRecord.SalesId);
queryRun = new QueryRun(query);
jobCardReport = new MenuFunction(menuitemOutputStr(TestCard), MenuItemType::Output);
args.parm(strFmt("TestCard_DynamicParameter=%1, %2", salesTableRecord.CustAccount, salesTableRecord.SalesId));
jobCardReport.run(args);
super();
}
The last 3 lines of code allowed me to pass manual selections from the query dialog using the "Select" button. But on subsequent runs, the manual selections remain despite which record is displayed in the SalesTable form.