Rule Templates

Rule Templates Use Case

When configuring multiple Sources within DataForge, it is common for repeated patterns of Enrichment Rule logic to be created across multiple Sources. For example, imagine an environment with 3 Sales Sources that contains information about Sales that an organization makes across multiple stores. Each Source needs a rule for Profit, defined as [This].Revenue - [This].Expenses.
 
3 Sales Sources with a Profit Enrichment
 
In the event that the user needs to change the Enrichment expression, they unfortunately will need to edit the expression in three separate places, one for each Source. This process is time consuming and prone to user error. The user needs the ability to manage the expression for all three Sales Sources in one place. In DataForge, this functionality exists as a Rule Template.
 

Managing Templates

Selecting Templates->Rule Templates from main menu opens Rule Templates list view :
 
 

Creating new Rule Template

Clicking NEW + button opens new template Setting tab:
 
New Rule Template Settings
 
You need to select the Test Source before you can start configuring template attributes. The Test source is required for enabling auto-complete attribute dropdown for [This] source container and related sources. Token values configured for the selected Test Source will be used for validation of the Template. These values can be updated by the user.
 
New Rule Template Settings Tab
 
Rule templates are created identically to how normal Rules are created.  For more information, visit the Rules documentation. After the Rule Template settings have been completed, select the Test button to confirm the rule expression is valid.  Save the rule template to proceed to applying the template to sources.

Using Tokens in Rule Template Expressions

Tokens can be utilized in Rule Template expressions. The following attributes of the Rule Template can be tokenized using ${token_name} syntax:
  • Attribute Name - formatted as [Source].${token_name}
     
     
  • Expression - must be quoted string like '${token_name}'
     
     
Typing $ will display searchable list of configured tokens:
 
Using Token in Rule Template attributes
 
Examples of token use
Example Description Result
'${token}' Parameterize string rule '22334'
'${token}_id' Parameterize string rule with other strings '22334_id'
[Source].attr_${token} Parameterize attribute name Result from rule or raw attribute 'attribute_22334'

 

Linking (applying) the template to sources

Once the template has been tested and saved, it can now be linked (applied) to sources. When the template is linked to a source, DataForge substitutes any token values used in template expression with values configured for each target source, generates and validates rules for each of the sources and saves them. To link the template to sources click on Linked Sources tab.
 
Linked Sources Tab
 
To link source(s), click NEW + button and select checkboxes next to the sources in the searchable list. Sources already linked to the Rule Template do not appear in the list again.
 
Select source dialog
 
After selecting sources, click the Apply button.
Validation status dialog showing the error message
 
Sources marked with a green checkmark passed the template validation and are ready for the template to be linked. Sources with a red exclamation didn't pass the validation. Clicking the red exclamation icon shows the validation error details.
 
Clicking the source name from the validation modal opens a new browser tab directly to that source's Rules tab.  To make the template validation work, users would need to correct any configuration issues mentioned in the error message. Once the issues have been corrected, click Retry button on the validation modal to retry applying the template or close the validation modal and try again without the failed sources selected.
 
If all of the sources selected are valid with the rule template expression, the rules will be immediately applied/saved to the sources.
 
Clicking on Source Name on the Linked Sources tab list opens up new browser tab with Linked source Rule dialog:
 
Template-linked Rule Dialog
 
Rules linked to Template cannot be edited directly. Actions available are:
 
Action Description
View Rule Template Link Opens Rule Template setting page
Duplicate Clones Rule and opens it up in new dialog
Unlink Removes link between Rule and Template and converts Template-linked rule to regular Rule
Delete Removes link between Rule and Template and physically deletes the rule. Equivalent to "Remove Linked Sources" action on Template page

Updated

Was this article helpful?

0 out of 0 found this helpful