How to Write a Data Source Provider Class
When a new SSRS report design is registered in Docentric report setup, the Docentric Default DSP class is set to be used with this report by default. This class is a part of Docentric AX Framework, and enables reusing of existing SSRS report data sets that are filled by built-in RDP classes or queries.
When to use a custom DSP class
You will create and use a custom Docentric DSP class when you want to:
- Add additional data to existing SSRS reports, without changing built-in report artifacts such as RDP (Report Data Provider) classes, tables or queries. You will be able to accomplish this much easier than using extensions.
- Create a new custom SSRS report, without using RDP classes or tables. You can add data from arbitrary AX tables and views, or any other internal or external data source, using plain X++. Data can be calculated and shaped into meaningful groups and hierarchies.
- Manage custom placeholders used in Docentric print destinations.
- Dynamically change print destination settings, e.g. to select different template, or to add additional email attachments.
- Define Docentric archive contract, in order to use all features which Docentric adds to built-in Print archive, Additional email attachments, Saving reports to Attachments and Report log.
Assign a custom DSP class to report in Docentric report setup
If you create a custom DSP class for your report (e.g. the DocFreeTextInvoiceReportDSP class for the Free text invoice report), you have to select this class for the report in Docentric report setup.
How to create a custom DSP class
Custom DSP class is an extended class of the Docentric Default DSP class (DocDataSourceProviderSrsReporting) that overrides particular methods. We prepared Visual Studio templates of custom DSP classes for different scenarios.
So, you don’t have to worry about extending the proper base DSP class and implementing (overriding) the proper methods. The VS template will do this for you. Basically, there is only a couple of methods you will deal with:
- The generateXmlDataSource() method – to append additional data to a report data source or to create a report data source from scratch.
- The addDataFieldsForRdpTableRecord() method – to add additional data to each record of a RDP table from report data source.
- The overrideReportRunSettings() method – to manage custom placeholders or to dynamically change print destination settings.
Check out the Visual Studio templates for DSP classes >>
Docentric AX APIs
For example, to add additional data to a report data source in generateXmlDataSource() method, you will use the DocXmlRecordBuilder class and its methods to quickly add table buffers with all or only particular data fields, field groups, display methods, etc.
You can also explore Docentric replicas of commonly used SSRS reports such as Customer invoice and Purchase order. This way you can learn about designing practices as well as techniques of using Docentric custom DSP classes.
DSP classes can serve not only for adding/removing data to/from an existing report data source but also for reshaping it. For example, you can restructure fields of a data table into hierarchical groups, move ‘header fields’ from a data table for report lines to a header table, break one data table into multiple tables, e.g. into a report header and lines tables.
See also
Docentric Training for Writing Custom DSP Classes >>
How to Use Docentric AX APIs >>
Docentric Data Source Packages (DDSP) Overview >>
Visual Studio Templates for DSP Classes >>