Interview Questions

Tuesday, September 27, 2016

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

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);
   
    if(paramValue1)
    {
        dataContract.parmReportName(reportname.design_1);
    }
    else if(paramValue2)
    {
        dataContract.parmReportName(reportname.design_2);
    }
   // 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.
    controller.parmArgs(_args);
    controller.startOperation();
}
 

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.

No comments:

Post a Comment