How to Send a Docentric SSRS Report to Multiple Print Destinations

For Print Management reports basically the Form setup form for setting multiple print destinations should be used.

Nevertheless, if you want to achieve some custom scenarios you can run a report from the code. The simplest way to print a report from the code to multiple print destinations is to run report from the code multiple times with different print settings. But this way the execution of logic for fetching the data needed for the report is repeated for each of report runs.

However, we can print the same report to more than one print destinations in the more effective way using Docentric AX APIs. Let’s say that we want to print a particular Customer invoice to multiple print destinations at once. It would be more efficient if we fetched the report data first, and then print the report to different print destinations. In order to achieve this scenario we should also assume that we registered Customer invoice as Docentric report and that we created a custom DSP (Data Source Provider) class for it.

1. Using the renderingCompleted event

The first way to print the same report to multiple print destinations in the more effective manner is to use the built-in SSRS renderingCompleted event. Take a look at the following job:

In the following line of code we registered an event handler for the renderingCompleted event of SalesInvoiceController inheriting the SrsReportRunController base controller class:

In the custom Docentric DSP class (SalesInvoiceReportDsProvider) of Customer invoice report we need first to override the overrideReportRunSettings() method in order to tell Docentric AX Framework that only report data should be executed, without sending the report to any of print destinations.

And finally, here it is the event handler for the renderingCompleted event of the SalesInvoiceController controller class, where the report is dispatched to multiple print destinations:

2. Preparing report data in advance

The second way to print the same report to multiple print destinations in the more effective manner is to use File as the target Print destination and XML as the target Output file format. This way only the run-time report Data Source Package (DDSP file) is generated and saved to file system. DDSP file can be then used as pre-pared report data source to execute report to different print destinations without fetching the same data again.

Take a look at the job where we generated only the report DDSP file:

Once we have report DDSP file generated we can use it to print the report to multiple print destinations:

With report data generation and dispatching report to one or more print destination as separated tasks you can gain more control and achieve some advanced custom scenarios, e.g. mass printing of Customer invoices.

See also

How to Run a Docentric SSRS Report from Code >>
How to Dynamically Change Print Destination Settings >>
How to Use Placeholders in Print Destination Settings >>
SSRS Report Examples >>

IN THIS ARTICLE