Template refers to a common layout of nodes that can be used to create a model that has a repetitive pattern of node structure. The template is created once as per the user's needs and can be reproduced any number of times within the model to build it.

The below example shows how a template named Net Profit is created once and has been reused for different product categories.

Click the Templates menu in the toolbar to enter the template section. There are two options available to you:

1. Create your own template

2. Import an existing template

Let us first see how to create a new template.

Create New Template

After clicking the Create New Template option from the pop-up, the editor screen is displayed to start building your template. An editor screen just like the model tab editor is available to you to create your template structure.

Creating a template is similar to creating a new model, more precisely, a subset of the model where all the modeling features can be used such as adding new nodes, editing the nodes, moving and re-ordering, hybrid formula configuration, etc.

Find below the image of a template being created just like building a model. You can refer to this section for more help on using the modeling features.

Click on the vertical ellipsis next to the template name at the bottom to duplicate or delete it.

Click on the + icon as shown below to create and/or import further templates.

Nodes in the template can be of any type - manual input/data source/formula type.

Template Keys

A unique feature in the template editor is a special type of node called a Template key node. Template keys are a list of keywords taken from the leaf nodes that are used in creating Data Source nodes in the model.

While creating the template structure, you can choose the required template keys for the driver nodes that need to get values from the data source. For example, if you want the 'selling price' and the 'units sold' as the driver nodes to be picked from the data source, you can choose them as template keys from the leaf level (GL Account Category).

Upon creating and applying the template to the model, the template key is paired with the source key to identify its lineage, and the template key nodes are displayed as Data Source type nodes in the model.

How do Template Keys work?

Step 1: Add template keys in the template.

You can choose any one of the three ways listed below to add template key(s).

  1. Select the node and click Add Template Key Node on the toolbar.

  2. Create a node and choose its type as Template Key in the Type dropdown.

Step 2: Configure Template keys.

ValQ allows you to configure the template keys by letting you choose the last level nodes (leaf nodes) of the model from the data source. These leaf nodes are automatically presented in the pop-up as shown.

If you have not assigned any data to the visual, you will be prompted to do so in the Add Template Key Nodes pop-up as 'Add Category and Values fields to the visual'.

Select the relevant leaf nodes from the list.

Step 3: Select whether you want it to be a child node or a sibling node and then click Add to apply. Template keys are now configured and the template is ready.

Find below the Net Profit template that has been created using the above steps.

The leaf nodes belong to the last category assigned to the visual for models having uniform structure. In the case of a ragged hierarchy, the template keys are leaf nodes belonging to different levels.

Step 4: Apply template.

Now, while applying the template, these template keys fetch the relevant leaf node data for some or all of the categories based on the source key(lineage of the node it replaces).

In the below image, template keys such as Selling Price, Units Sold, Other Income, etc. fetch the relevant leaf nodes from the product categories - Men, Women, and Orange. On applying the template, the Selling Price, Units Sold, and Other Income nodes become the respective Data Source nodes of the model.

FAQs on templates

1. Data source nodes also fetch data from the data source. What is the difference between template keys and data source nodes?

The template key only contains the leaf part of the source key (the last level in the lineage) while Data Source node is created with the complete source key (the entire lineage).

Hence DataSource nodes refer to static nodes (E.g. US/Clothing/Men/Units Sold), while template keys (E.g. Units Sold) can refer to and fetch any leaf node depending on the lineage dynamically.

As the template key is only a part of the source key it can be used to create many nodes across the model that fetches its respective values based on the lineage. This dynamic nature of the template key helps in scaling the model whenever new data is added.

2. Are template keys mandatory to create templates?

Templates can be created without template keys too. For example, in use cases where you would want to insert or replace nodes with a repetitive set of numerical/calculation nodes at different levels, you can create nodes that are of manual input type/data source type/formula type.

In the below example, a template has been created with only the formula nodes to calculate variance.

3. How does template help in scaling the model?

By creating a dynamic model, whenever the data set is updated with new data such as a new product or division, the new data is automatically added as nodes to the model, and template structure is applied to these nodes.

4. Can the template structure be modified after applying it to the model?

Yes, to modify a template structure go to the Templates section, and select the respective template tab to edit the nodes.

-> To know how to apply the created templates, go to the next section.

-> To understand other template actions like - modifying the template application rules or copying the rule to other dynamic nodes, or removing the template from the model, refer to this section.

-> Import and Exporting templates are explained in the further sections.

Last updated