This post discusses about the use of report data provider, contract and controller classes for the SSRS report
Contract class:
This class is used to define the paramters that are required to be given before running the report. The parameter are defined as parm method in the class and the attribute DataMemberAttribute defined at the start of method and DataContractAttribute defined at the class declaration.
Example class SalesInvoiceContract can be referred
Report data provider class:
This is used to access and process data for a SSRS report. The RDP class processes the business logic and returns a dataset to the reporting services. In order to create a RDP class in AX, you have to extend that class with SRSReportDataProviderBase
As a best practice the class name can end with “DP”
– Some attributes need to be defined for the RDP class.
SRSReportParameterAttribute – This defines the contract class used for the report dialog where we can enter the parameter values to run the report if any. This atribute is optional and can be defined at the class declaration level
SRSReportQueryAttribute – This defines the AOT query that is used for the report . This attribute is optional as well and can be defined at the class declaration level.
SRSReportDataSetAttribute – This defines the dataset that is used to store the report data. You can define a new method and name it getXXXTmp and define this attribute for the method. This is madatory and is used to identify the table buffer where the report processed data is stored.
– the method processReport() needs to be defined. This method is used to fetch and store the data in temporary table
– when designing the report in visual studio, under the dataset section, Data Source Type can be set to report data provider and in the Query field the newly created DP class can be selected
Controller class:
Controller class is used to control the report processing/execution like controlling the parameters, calling the report from classes/forms, modifying the report query etc..
The class that can be extended for controller is SrsReportRunController
– Various methods can be overriden based on the requirement
– Some of the mehods that can be overriden are
prePromptModifyContract: This is called before the parameter dialog is shown
preRunModifyContract: This is called before the report is run.
– Create main() method to pass the report name, design to start the execution of Report.
Sample main method can be as follows
public static void main(Args _args)
{
SrsReportRunController controller = new TestController();
controller.parmReportName(“TestList.Report”);
controller.parmArgs(_args);
controller.startOperation();
}
*This post is locked for comments