You are here: Key Features > Content Re-use > Rule and Action Templates

Rule and Action Templates

Templates allow fragments of rules and actions to be created and stored, and reused by rules, actions, and other templates.

If a modification is made, the change is picked up by all items referencing the template.

Note: You cannot delete a template when it is referenced.

Rule and action templates can be referenced inside other templates so that trees of rule templates can be created with a rule or action at the root.

Note: If a template tree is too deep, you may experience performance issues.

The output from the template can be a value, a condition, or a relation.

For example, a template can be used to define the relationship between road elements that make up a roundabout. The parameters are the objects that define the roundabout, and the output is a geometry value. This template can then be used in all rules that need to access roundabout geometries.

Creating Templates

Rule and action templates are created with objects as parameters. The object is defined in an input parameter to the template. A template can have zero to many parameters.

Parameters can be added, removed, and changed even when the template is referenced.

ClosedCreate a Rule Template

  1. Navigate to the Rules page.

  2. In the Navigation Pane, select New > Rule Template.

    A new rule template opens.

  3. On the General tab in the Name field, enter the name of the rule template.

  4. On the Rule Condition tab, select the Rule template node.

  5. On the right-hand pane, click Add parameter.

  6. To rename the class in the template to match the class in this rule, select the Parameter [n] checkbox.

  7. In the Class list, select the class for the parameter.

  8. In the Name field, enter a name for the parameter.

    Click Add parameter.

  9. Repeat steps 5 to 8 until you have added all your parameters.

  10. Set up the conditions for the rule fragment.

  11. Click Save.

    The rule template is saved in your selected folder.

ClosedCreate an Action Template

  1. Navigate to the Actions page.

  2. In the Navigation Pane, select New > Action Template.

    A new action template opens.

  3. On the General tab, type the name for the action template in the Name field.

  4. On the Action Definition tab, select the Action template node.

  5. On the right-hand pane, click Add parameter.

  6. Select Parameter [n] to rename the class in the template to match the class in the action.

  7. In the Class field, enter the class for your parameter.

  8. In the Name field, enter the name for your parameter.

  9. Repeat steps 5 to 8 until you have added all your parameters.

  10. Set up the conditions for the action fragment.

  11. Click Save.

    The action template is saved in your selected folder.

Using a Template

Templates can be used within rules, actions or other templates.

Once inserted into a rule or action, a template fragment is tailored to use the classes required.

Note: To pass parameters correctly, each parameter's class or name must be used in the rule or action before the template is inserted.

ClosedUse a Template within a Rule

  1. Navigate to the required node in the rule.
  2. Click New and select Rule Template.
  3. Select a rule template and click OK. The rule template is inserted into the rule.

ClosedUse a Template within an Action

  1. Navigate to the required node in the action.

  2. Click New and Action Template.

  3. Select the action template from the list and click OK. The action template is inserted into the action.