Document generation feature is very popular among TeamDesk online database customers. In connection to this functionality one of the most frequently asked questions is how to restrict a list of related details in a produced document template.
This post provides instructions and examples of such an adjustment.
Every generated document produces a formatted output of a particular record data, supplemental with a related details view or even with multiple details views. For instance, there is a Customer Profile record with the list of related projects. If a project is approved by a customer, the “Approved” checkbox is checked in this project record. So, you need to see all the projects related to a Customer, but only Approved projects should be included into a generated document.
Additional Details View with Filter
Typically, an existing relation (One Customer – Many Projects) produces a “details” view, for instance, a “Default Project” view, where you can review all related projects. But, at the same time, you need to insert a list of approved projects into a document, therefore a separate “details” view must be added. To do that, create a new view with a filter, for example, with [Approved] is checked.
Many-to-Many Relation
To display this view as “related details”, you should build a Many-to-Many relation with a match condition. You don’t need any reference columns for this, just create a relation between two tables Projects and Customers.
After that, select the “Approved Projects” view as a “details” view.
Match Condition
The next key step is setting a match condition.
To match the Customer Profile with the Customer specified in project records, the following match conditions should be added:
Id=Customer
Without this condition, all the existing Approved Projects will be listed as “details” in every Customer Profile, that’s why a “relation” must include a “match condition”.
Now you can see the Approved Projects “details” view listed under the Customer profile.
If you want to hide the Approved Projects “details” view tab, it can be done by form behavior settings.
More info is described in the blogpost How to Use Form Behavior to Hide Details View.
Document template
Generate a template and place the Approved Projects “details” view into your document.
As a result, a generated Document would only contain approved projects.