Wednesday, June 19, 2013

AX 2012 – SSRS Reporting : Selecting the report design at the runtime based on the static parameter (dialog field) values


Here is a solution to select the design at the runtime based on dialog field values in AX 2012 SSRS reports. Hope this will help you.

Create a controller class that extends SrsReportRunController()
And override preRunModifyContract() in the controller() class and follow the below steps.
protected void preRunModifyContract()
    boolean     paramValue1;
    boolean     paramValue2;
    SrsReportDataContract dataContract = this.parmReportContract();
    SrsReportRdlDataContract contract = dataContract.parmRdlContract();
    paramValue1 = contract.getValue(Param1_name);
    paramValue2 = contract.getValue(Param2_name);
    else if(paramValue2)
   // else default design is used to display the report which is used in main(); or you can specify your design name here
static void main(Args _args)
    xxx controller = new xxx (); // Let us assume the current class as xxx
    controller.parmReportName(reportName.defaultDesign);  // Make sure you specify the default design while running the report and this is required to run the report and to get the dialog.
And now, Create the output menu item and specify the object type to class and specify the object to this controller class which we create now. And the report is ready to select the design at runtime.
Hope this will helps you,
Prasan.. J