Nested template

Reusability has its inherent advantages

  • Create once and use in multiple places.

  • Template Editor looks less cluttered and therefore easily understandable, particularly in cases where you have conditionals for multiple tabs in a tabbar.

  • When there is a change, you only have to make the change once in one temaple fragment, thereby removing the risk of missing the changes elsewhere when not using template fragments.

It does not mean that you should use nested templates only for the purpose of reusability. You can use them even when there is no reusalibity, but just to declutter your Template Editor.

Prerequisites

To implement nested templates, you need to have template fragments created.

Refer the page for Template fragments if you would like to familarise yourself with the topic.

Nested templates are nothing but templates within templates - that is, one or more template fragments added on to an interaction template.

if you know how to create template fragments, then creating nested templates is all about dragging and dropping them into the Template Editor.

Properties

Template - This refers to the Template Fragment choosen from the template fragments assets.

Visible when - This allows you to show/hide the Template Fragment based on certain conditions that you might want to set. However, the same result can also be achieved using Conditionals. And it is recommended to use Conditionals instead of this property, mainly because the condition is not hidden in the properties panel, but immediately visible to someone looking at the Template Editor. This improves readability.

Illustration

Let's build upon the EMS use case from where we had left at in the page for 'Tabbar'. We had built an interaction template with a Tabbar consisting of two tabs and Datagrids inside Conditionals that should be displayed based on the tab clicked.

Let's try to replace the Datagrids with Template Fragements.

  1. In the Project Resources pane on your modeler, click on the tab corresponding to 'Templates, widgets, files and hyperlinks'. Create Template Fragments for 'Clients' and 'Projects'. The steps for creating the Template Fragements are not detailed out here. Refer the page linked in the prerequisites for further details on this topic.

  2. Let's remove the Datagrids from the Template Editor, so that we could use nested templates instead.

  3. Then, in the Template Editor, click on the 'Nested template' icon and drag it to the canvas. This would prompt you to select a Template Fragment. Select one and add it to the canvas. Do the step for adding both the Template Fragments.

Alternately, you could just drag and drop the Template Fragment from the library on to the canvas.

4. You have now nested these two Template Fragments into the Template Editor.

Last updated