I have an old report which was developed by my predecessors. Users have been running the report from a menu item and it is working fine with them. Now we have a new requirement to run this report daily and send the report by email.
We already have many reports SSRS and Morphx running daily and sent on email. Our Morphx report execution code is as follows:
args = new Args(reportName);
args.caller(reportRun);
reportRun = new reportRun(args);
reportRun.design(reportDesign);
reportRun.query().interactive(false);
reportRun.report().interactive(False);
reportRun.args().caller(null);
reportRun.setTarget(printMedium::File);
reportRun.printJobSettings().setTarget(PrintMedium::File);
reportRun.printJobSettings().format(reportFormat);
reportRun.printJobSettings().fileName(fileLocation+customReportFormats.morphXExtension(reportFormat));
reportRun.init();
reportRun.run();
This code is working perfectly fine with all our current Morphx reports.
We applied the same code for our current report, however it does not excute the report properly. The report file is created but its empty.
We went through the report design and found that there are many programmable sections. All the programmable sections are executed in a custom method called "DrawReportDesign" which in trun is called from an executeSection method of a Body in a SectionGroup. Find below a snip of the report design.

In the Methods node of the report there is no fetch method.
When users run the report they pass a parameter Batch Number, we are passing a range in our x++ code as follows follows before the init() and run() methods.
reportRun.query().dataSourceTable(TableNum(InventBatch)).addRange(fieldnum(InventBatch,inventBatchId)).value(batchNumber);
Range is set correctly however the report always tuns up empty. See below:
The printed data is labels of the programmable sections. From my little understanding of Morphx reports it seem that the programmable sections were never executed.
Any help will be appreciated