Contract Class:
Microsoft Dynamics AX 2012 introduces the concept of attributes. Attributes provide a way to specify metadata about classes and methods. Two of these attributes are used when creating data contracts: the DataContractAttribute and DataMemberAttribute attributes.
  •  The DataContractAttribute attribute is used to define that a class is a data contract.
  •  The DataMemberAttribute attribute is added to methods of data contracts that represent data members that have to be exposed.
Contracts are used to define what can be communicated.
  • A data contract are used for defining parameters to the SSRS report. We can define any number of parameters using X++ statements of any data type, which can be passed on to the RDP class.
  • A data contract class is an X++ class which contains parm methods with the DataMemberAttribute defined at the beginning of the method.
RDP Class:
The RDP class is a data provider that allows you to add business logic for the data that is displayed on a report. The business logic for this example prompts the end user for parameter values, processes business logic to generate data in a table, and then returns the table to render in the report. In this section, you define the RDP class by extending the SRSReportDataProviderBase class.
The following list describes the attributes that are attached to the RDP class for this example:
  •    Attach the SRSReportQueryAttribute attribute to specify the query to use to get the data for the report.
  •  Attach the SRSReportParameterAttribute attribute to specify the data contract class that defines the report parameters for the report



  •                         or

    1. Report Data Provider (RDP) Class

  • Report Data Provider Class is an X++ class that is used to access and process data for a SSRS report. The RDP class processes the business logic based on a specified parameter and/or query 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. This tells AX that this class will be used by reporting services to process the data.
    Two important attributes are used in RDP classes:
        1. SRSReportQueryAttribute: specifies which AOT query will be used in this report. If the RDP class uses an AOT query to process data, define this attribute at the beginning of the class.
        2. SRSReportParameterAttribute: defines the data contract class that will be used by this report to prompt for parameter values. If the RDP class contains any parameters this define this attribute at the beginning of the class.
    Both the attributes are optional. If the report does not use any query or does not want any parameter to filter report data, these attributes do not need to be used.
      1. Data Contract Class

    A data contract class is an X++ class which contains parm methods with the DataMemberAttribute defined at the beginning of the method. This class is used to define one or more parameters that will be used in a SSRS report.
    1. Table

    An AX table is used as the dataset to store data for the report. The RDP class processes the data and stores it in the table which is then used by a SSRS report to render data.
    A table can be a temporary table (InMemory or TempDB) or a regular table, but it is Microsoft best practice to use a temporary table.
    The type of temporary table is based upon the performance considerations. InMemory temporary table is used when the data set is small, while TempDB is normally used for larger datasets to improve performance.
  • .getCustReportRDPDemoTmp
  • Add a new method and name it getCustReportRDPDemoTmp. This method is mandatory because reporting services uses this method to get the table buffer containing the processed data. The SRSReportDataSetAttribute attribute is used to indicate the temporary table name and also tells the reporting services to use this method to retrieve the processed data.
  • Write the following code in the method:
  • processReport
  • Add a new method and name it processReport. This method contains the business logic and is called by reporting services to generate data.
  • This method will query customer details and fill the temporary table buffer. Write the following code in the method:
    1. A report will be added to the project with the name Report1. Rename the report RDPBasedDemo.
    2. Now double click the report to open it.

      1. The description of the individual node is given below:
        1. Datasets: Datasets retrieve data from RDP class. It acts as a bridge between AX and the SSRS report. Only the fields added in the datasets can be used in a report.
        2. Designs: It defines the layout of the report.
        3. Images: It contains the images that you want to display in the SSRS report.
        4. Data Methods: It contains the business logic which can then be used in the report.
        5. Parameters: It is used to apply filtering to the data in a report. All the parameters defined in the data contract class are automatically added here when the RDP class is defined in the datasets.
          1. There are two types of designs that can be created in a SSRS report:
            1. Auto design: Visual studio automatically creates a design based on the dataset provided. Auto design is the preferred method because it is easy and usually fulfills the majority scenarios.
            2. Precision Design: This is used when you need custom placement of fields or the layout of the report is too complex.
          2. In this demo we will use Auto Design. Now right click the Designs nodeàAdd àAuto Design. A new design is added. Rename it Design. It is recommended that you set the name of the Design to either ‘Design‘ or ‘Report‘.

Comments

  1. Congratulation for the great post. Those who come to read your Information will find lots of helpful and informative tips. Retrieve Company Info

    ReplyDelete

Post a Comment

Popular posts from this blog