<< Click to Display Table of Contents >> Document templates with tables within tables |
Overview
Bizagi allows generating document templates that include tables within tables. That is, a set of multiple records that relate to a collection, and those multiple records another set is contained.
Remember that to make reference to a collection in a template you must use the following tags:
[Foreach:CollectionName]: Indicates the starting point of the collection.
[AttributeName]: All attributes between the Foreach and the End tag must belong to the collection.
[End]: Indicates the end of the collection.
When using Foreach and End tags or phrases be sure to capitalize them as specified. Otherwise, it will not be possible to identify the starting or ending point of the collection. |
What you need to do
To nest tables (include one set of values within the other) you must nest Foreach sentences. This means that there should be a Foreach sentence for each set of values, and one will be contained in the other. The syntax would be:
[Foreach:Collection1Name][Foreach:Collection2Name][End][End]
You can nest Foreach sentences up to one level. That is, you can nest a child collection within the main collection. Nesting multiple levels (i.e., nesting more than one child collection within the main collection) is not supported. |
Notice that Bizagi registers records from the inner table to the outer table. Thus, in the outer set of values, some rows will be repeated, like shown in the image above (i.e Business Career is repeated whilst the Candidates names are set).
If you need to display a scenario like the one mentioned without repeating the outer set's values, use the closure End sentence in the inner set of values. This way, Bizagi will register the elements within the inner set and then move to the out set. Additionally, the inner set of values should be contained in an independent Word table. The syntax and tables would look like this:
Example
The Agility University uses Bizagi to manage the admission process of new students. At the end of this process, a final report must be generated including the list of approved and rejected candidates for each career.
As show in the image below, the list of careers is included in the data model as a collection called Careers. As well, the list of candidates for each career is called CareerCandidates. Note that this is a collection within a collection.
The information is presented in the Work Portal as below. Each career has multiple candidates associated:
To generate the final report we will use a document template. Follow the next procedure to configure it:
1. Create the template
In this case we will use a Word template. Open Microsoft Office Word and include the structure an format of the document.
2. Reference the information that will be dynamically obtained from the Bizagi data model.
Include the Template Tags to obtain the information from the data model of the Process.
First include the simple tags.
Now include the tags related to the Career collection by using the [Foreach:Career] sentence.
As all the tags typed from this tag until the [End] tag are assumed to be attributes of this collection, we can use another Foreach sentence within a table to reference the multiple Candidates of a specific career without repeating the career name.
Once all the attributes of the last collection have been included, use the [End] sentence twice to close the references.
3.The mapping is done as usual. Just relate each parent collection with their corresponding tag. Do the same for their attributes.
In the Work Portal the information is displayed
When generated from the Work Portal, the document template will
Last Updated 7/14/2023 11:16:21 AM