Skip to main content

Posts

Showing posts with the label report

Passing Parameters to a Report in Dynamics AX

Creating reports in AX is generally ‘a walk in the park’ even for the new developers not fully acquaint with the syntax of X++. However, it sometimes becomes challenging to understand how the parameters could be passed to a report when you want to initiate that report from a form. Let’s look at an example where you may want to create a ‘Purchase Requisition Report’ that the users could generate to see the status of each purchase requisition and the associated workflow entries for that Purchase Requisition. I will not go into the details of how to develop this report, but you should know that such a report do not exist in the out-of-the-box functionality within AX 2009. So let’s say that you have developed this report and now when you generate this report you can pass on the required ‘Purchase Requisition ID’ in the ‘Parameter Prompt’ of the report to view the particular PR details accordingly. However, now in the next step you want to call this report from the ‘Purchase Requisition...

Make axapta x++ report at runtime

With that, we can to create and modify our reports dynamically, and adjust its properties at runtime. static void MakeReportAtRuntime(Args _args) { #AOT str reportName = 'MakeReport'; tableid custTableId = tablenum(CustTable); TreeNode reportNode = TreeNode::findNode(#ReportsPath); Report areport; ReportDesign design; ReportAutoDesignSpecs specs; ReportSection section; ReportRun run; ; //Delete the report if it already exists areport = reportNode.AOTfindChild(reportName); if (areport) areport.AOTdelete(); //Build the report areport = reportNode.AOTadd(reportName); areport.query().addDataSource(custTableId); design = areport.addDesign('Design'); specs = design.autoDesignSpecs(); section = specs.addSection(ReportBlockType::Body, custTableId); section.addControl(custTableId, fieldnum(CustTable, AccountNum)); section.addControl(custTableId, f...