How to Add Additional Data to a Docentric SSRS Report

The concept of customizing an existing SSRS report using so called Docentric approach hasn’t changed for D365FO comparing to the AX 2012 product version. We explained it in details in the corresponding AX 2012 how-to manual. See the manual >>

Note that the X++ code from DSP classes for D365FO and AX 2012 platforms is 100% compatible, so you can use the same code snippets from the above AX 2012 how-to manual in your D365FO project directly.

The only difference is that instead of using the wizard for AX 2012 (a code generator), we will use a Visual Studio template for DSP classes.

Adding additional data to a report is the most common customization requirement. The implementation consists of:

  • Adding the additional data to the datasource
  • Transferring the information about the new datasource from D365FO into the template
  • Adding the new datasource fields to the design.

We will describe the process on the example of Purchase Order report, for which a Docentric replica is available.

Customization process

Adding the additional data to the datasource (role: developer)

  1. Implement modifications in the code in order to add the new fields to the datasource. You can use the Docentric approach and do it in a relevant DSP class as shown in the image below (see the manual with detail instructions and examples >>), or you could use the non-Docentric approach with customizing SSRS artefacts.

  2. Build the solution, so that the modifications are deployed to D365FO. Inform the template designer that the required modifications are available.

At this point, the mandatory developer’s job is done. If developer wants to make sure that he/she did what was requested, it makes sense that he/she performs also the steps 3. and 3.a. below.

Transferring the information about the new datasource from D365FO into the template (role: designer)

  1. Execute the report with the option Generate DDSP file when report runs in the Docentric report setup. As a result, DDSP file with the new datasource is generated.
    • Because DDSP file is XML format, developer/designer can open it and search for the name of the new field(s) in order to check that they exist in the new DDSP, and also to check that they have the correct values. Some developers stop at this point and let the template designer know that the new code version is working correctly. Some other developers go up to the point 7.

  2. Download the last working version of MS Word template (or start from some local version) and open it in MS Word
  3. Import the new DDSP file into the MS Word template (Docentric AX toolbar > Load Data Source > point to the generated DDSP file)

Adding the new datasource fields to the design (role: designer)

  1. Check that the newly added field(s) appear in the corresponding datasource record in the Data Source pane

  2. Optional step (to be even more sure that everything is OK): view sample data and check that the newly added field(s) have the expected values (equivalent to 3.a)

  3. Modify the Word template as needed. For example: add a field tagging element(s) with bindings to the newly added data field(s).

  4. Optional: preview the result and verify that the values are printed as expected

  5. In the Docentric report setup, Template specification section, attach this modified Word template instead of the previous one.
  6. Run the report and make sure that the new data fields appear on the new report and have the correct values.

Docentric report setup with non-Docentric approach

There are situations when you decide to use the non-Docentric approach for customizing the datasource. This usually happens if you already have customized SSRS objects which you want to reuse. Most probably you have the customized SSRS report with another name, for example PurchaseOrder_New. Now you want to combine the custom SSRS report with Docentric replica template for PurhaseOrder report.

You need to create a new configuration in the Docentric report setup and you will probably try to do the following:

  1. In Docentric report setup add a new entry, for example PurchaseOrder_New, based on the PurchaseOrder_New SSRS. You will select the report-specific DSP class (DocPurchPurchaseOrderDSP in this example) instead of the default one.
  2. Go to the standard Docentric PurchaseOrder replica report setup and download the standard Docentric replica template (.docx file).
  3. Go back into the PurchaseOrder_New report setup and attach the .docx from the previous step. This is wrong!
  4. Validation informs you that the attached template doesn’t match your report and you call support.

Why did you get validation error in the step 4? You are configuring the Docentric report for the PurchaseOrder_New SSRS report, but Docentric recognizes that the .docx template from the step 2 was created based on the different SSRS report (PurchaseOrder).

What is the solution? Just the two additional steps, 1.a. and 2.a. below:

  1. In Docentric report setup add a new entry PurchaseOrder_New (same as step 1 above)
    1. Run the report once with active option Generate DDSP file when report runs in the Docentric report setup, in order to get the DDSP file. Note: you will get the error message, because no valid template is attached to this report yet, but ignore the error, because your goal is to get the correct DDSP file, and it will be successfully generated.
  2. Go to the standard Docentric PurchaseOrder replica report setup and download the standard template (.docx file).
    1. Import the newly generated DDSP file from the step 1.a. into the .docx file downloaded in step 2 and save the .docx. This file will now internally store the information that it relates to the PurchaseOrder_New SSRS.
  3. Go back into the PurchaseOrder_New report setup and attach the .docx from the previous step.
  4. Validation is happy!

If you further need to customize this report, by adding new additional data to the datasource, you can select to maintain the new modifications in the PurhcaseOrder_New SSRS artefacts (non-Docentric approach), or to use the Docentric approach described in the Customization process at the beginning of this page.

See also

How to Write a Data Source Provider Class >>
How to Develop a New SSRS Report >>
SSRS Report Docentric Replicas >>

IN THIS ARTICLE