When including filters into your templates, there are two advanced features that can be included to increase the reporting capabilities of DocumentsCorePack templates: dynamic filters and column compare. This article serves to explain both features by providing example use cases.
Note: To use and understand these features, it is recommended to have experience with basic template creation and:
Prerequisites:
- DocumentsCorePack Server version 2020.105 or higher (see version and update info here)
- DocumentsCorePack Template Designer version 10.25 or higher (download here)
Dynamic Filters
Dynamic filters allow tables to be filtered based on a user-defined value that is passed in during the document generation process.
In the following example, we will create a template that contains one table that will be filtered by last name, and another table that will be filtered by a given date.
Example:
In this template, we have already created two tables, as shown below. The first table will only contain contacts with a last name that we will specify in one of our prompt fields. The second table will only contain contacts born after a specified date.
We will create two user prompts for our template, one for our last name filter, and one for our date filter. They will look like the following:
With our user prompts created, we can now create the filters.
To apply a dynamic filter to our first table, we will navigate to the Relationship Designer through the Template Designer. From there, click the ❶ Add button under Filter and then the ❷ Add button under Conditions. This will open up the ❸ Conditions window, where we will create the filter we need.Our other filter for our second table will be configured similarly, but for our “bornafter” user prompt instead. Note that the operator must be set to on or after in this case.
After both filters have been created and applied, save the template and generate a document. During the document generation process, an additional window will appear, prompting for a user-defined value.
Once the values have been entered, proceed through the rest of the document generation process. The resulting document should appear like the following:
Column Compare
Column compare filters a given relationship based on the compared result between two fields within the same record.
In the following example, our goal is to create an account template that lists all related contacts in two separate tables: one which displays all contacts whose primary and billing address are the same, and another which displays all contacts whose primary and billing address are different.
Example:
We will begin by creating two tables based on the Contact entity. The first table (“Matching Addresses”) will only contain the full name and primary address of the contact. The second table (“Separate Addresses”) will contain the contact’s full name, and both the primary and billing address.
For our second table, that configuration is similar, with the Operator being changes to not equals instead. This table will then only display contacts with different addresses in their address fields.
When a document is generated based on this template, the filter will be applied to both tables. The following figure shows an example result.
That’s it! We appreciate your feedback! Please share your thoughts by sending an email to support@mscrm-addons.com.