Translate

Wednesday, June 19, 2013

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

 
Hi,

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);
   
    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.
Hope this will helps you,
Prasan.. J
 

4 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Thak you for this post. Solution is really helpful and it is working!!

    ReplyDelete
  3. Really a very good one

    ReplyDelete
  4. i am new to ax..please help me..what is (param1_name) in
    paramValue1 = contract.getValue(Param1_name);
    please reply

    ReplyDelete