Introduction
There are some SSRS reports that have more than one format, such as SalesInvoice.Report, SalesInvoice.Report_IT, SalesInvoice.Report_FR and so on.
- One of them is default and is therefore an underlying format when you open the Print destination form. Print destination form “thinks” that this particular, underlying format will be executed. There are some elements on the Print destination form, such as Docentric template lookup, that are based on that information. This means that in this lookup you will see the templates you’ve registered in the Docentric report setup for the underlying format.
- But in runtime, the report controller may switch to some different, runtime format. When this happens, you might get unexpected results, especially in the combination with Docentric templates.
The goal of this forum post is to explain how Docentric decides which template to use and what results you can expect based on the combination of selected template and report-and-format combination registered for Docentric.
Tricky situation: different runtime SSRS format from the Print destination underlying format
Let’s say that your report has two formats: A and B, where A is default, i.e. underlying format for the Print destination form. In the Docentric templates lookup you will first see two tokens, @DOCENTRIC_DEFAULT_TEMPLATE@
and @SSRS_BUILTIN_DESIGN@
, and then a list of all Docentric templates that you have registered for the format A. And let’s say that under some circumstances, SSRS decides to switch the runtime format to B.
Under these conditions, this is how Docentric decides which template to use:
- If you selected the
@DOCENTRIC_DEFAULT_TEMPLATE@
token: when report is started, Docentric searches for a default Docentric template for the runtime format (B). - If you selected a specific template name from the lookup for the underlying format (A): when report is started, Docentric searches for a Docentric template with the same name, but for the runtime format (B).
- If you ignored the offered templates for the underlying format (A) and instead manually typed a specific template name: when report is started, Docentric searches for a Docentric template with that name for the runtime format (B).
Whichever the case, it is important to have the runtime format (B) registered in the Docentric report setup form, because if it isn’t registered, Docentric assumes that you didn’t want to use Docentric templates, therefore it lets the standard to print by using the SSRS default format.
If the runtime format (B) is registered, Docentric looks for the available templates registered for it. These are the possible outcomes:
- In case you selected the
@DOCENTRIC_DEFAULT_TEMPLATE@
token (point 1. above): Docentric looks for a template which is default for the current combination of legal entity and report runtime language, registered for the runtime format (B).- If such template exists, report is successfully printed based on that template.
- If it doesn’t exist, you will get a runtime error, that a default template for a report-and-format combination B isn’t found.
- In case you selected or entered a specific template name (points 2 and 3 above): Docentric looks for a template with that name, registered for the runtime format (B).
- The same as above, if such template exists, report is successfully printed based on it.
- If it doesn’t exist, you will get a runtime error, that a template with such name for a report-and-format combination B isn’t found.
What to do about this?
You cannot prevent SSRS from switching to other report (except through development). But you can get a control and adjust your expectations by knowing precisely the following:
- Which SSRS report-and-format combination is underlying for the Print destination? Check this blog post to find out how.
- Which SSRS report-and-format combination is runtime format (i.e. is in reality executed)? For that, you need to enable the flag Discover report technical name prior to executing the report. See instructions in this forum post.
Now based on this information, you will have a better control and will know what kind of setup will work for you.
- If underlying and runtime formats are the same, everything is fine.
- If they are different, and you plan to use a default template, just select the
@DOCENTRIC_DEFAULT_TEMPLATE@
token in the Docentric templates lookup (even though it is for an underlying format) and make sure that the runtime format is registered for Docentric and has a default template for the current legal entity and report runtime language combination. - If they are different, and you need to use some specific, non-default template, then enter manually its name in the Docentric templates lookup. Of course, make sure that the runtime format is registered for Docentric and has a template with a given name.
You can also check this forum post, where we described a similar situation on an example of Customer aging report.