How to Use Custom Placeholders in Print Destinations

In Docentric print destinations you can use placeholders. Custom placeholders are needed if the set of Standard placeholders is not sufficient to meet your needs.

Learn more about Standard placeholders >>

No matter if you are using Free or Full Edition, you can use both Standard and Custom placeholders. Moreover, we recommend you to install an additional model containing so called Docentric SSRS Replicas that already provide certain Custom placeholders for common reports such as Customer invoice and Purchase order.
Learn more >>

To implement Custom placeholders from scratch you will need to extend the Docentric’s base DSP class (DocDataSourceProviderSrsReporting), which is also called Default DSP class, and override the overrideReportRunSettings() method.

Besides overriding the overrideReportRunSettings() method, you have to decorate the same method with the DocPlaceholderAttribute attributes. For each of Custom placeholders, one DocPlaceholderAttribute attribute needs to be introduced, as shown in the following example.

If you have installed Docentric SSRS Replicas, and you need to add an additional report specific placeholder, you will be able to do more easily by following the same pattern described here but in the existing report’s DSP class, which is a part of the installed model.

Define and replace Custom placeholders with the corresponding values

Let’s say that for Purchase order you want to provide some Custom placeholders as an addition to Standard placeholders:

  • @PurchId@
    Note: It’s easier to use a Custom placeholder than the Standard one @FIELD_PurchId@; that’s why we introduced it.
  • @VendAccount@
  • @VendContactName@
  • @ResponseEndDate@

These Custom placeholders will be available for use in the File and Email print destinations.

You can use Visual Studio template of DSP class called DSP Class for Print Destination Placeholders.

Take a look at this custom DSP class (DTPurchPurchaseOrderDSP_OverrideRRS) for the Purchase order report:

Custom image placeholders

You can also email reports with images from the database in the email body using Custom image placeholders.
Image placeholders are defined using a different attribute – DocPlaceholderImageAttribute:

Also, for replacing an image placeholder with the image content loaded, e.g. from the database, we need to use a different method of Placeholder managerplaceholderMng.replacePlaceholderImage():

Learn more on how to use Custom image placeholders >>

Set up the custom DSP class to be used in Docentric report setup

In order to set up the Purchase order report to use this custom DSP class (DTPurchPurchaseOrderDSP_OverrideRRS) with the overridden overrideReportRunSettings() method, you have to add Purchase order to Docentric report setup (if you haven’t done this yet). Next, you need to select this new custom DSP class to be used for Purchase order instead of the Default DSP class.

Learn how to add an SSRS report to Docentric report setup >>

Now we can use both Standard and these four Custom placeholders in the File and Email print destination settings for the Purchase order report.

 

See also

How to Use Standard Placeholders in Print Destinations >>
How to Change Print Destination Settings Dynamically >>
How to Use the New Memory Print Destination >>

IN THIS ARTICLE