Modifying a report query based on the input data in AX 2012R3

Introduction:

Controller class is used to control the report execution as well as pre processing of the report data. The SSRS reporting framework uses this class to modify the report dialog, calling the SQL Server reporting services, as well pre processing parameters for the report.

How to do?

  1. Create a new class. Open AOT –> Classes
  2. Open the class declaration and select on View Code
  3. Now write the following code:
    class SSRSDemoController extends SrsReportRunController
    
    {
    
    }
  4. Create a new method and write the following code:
    public static client void main(Args args)
    
    {
    
    //define the new object for controller class
    
    SSRSDemoController ssrsDemoController;
    
    ssrsDemoController = new SSRSDemoController();
    
    //pass the caller args to the controller
    
    ssrsDemoController.parmArgs(args);
    
    //set the report name and report design to run
    
    ssrsDemoController.parmReportName(ssrsReportStr(SSRSSessionQuery,Design));
    
    //execute the report
    
    ssrsDemoController.startOperation();
    
    }

Conclusion:

Reports that are opened from a form – Controller class is also used when reports are opened fro a form and are needed to show selected records details. Use preRunModifyContract method to achieve this.


Share Story :