Rule Variables
Rule variables simplify editing when working with values that appear multiple times across your rules.
Rule variables work identically across all rule types - Decision Tables, Decision Trees, and Scripting Rules - though the syntax for using them varies by rule type.
Rule variables are version-specific. Each version of a rule maintains its own set of variables.
In this guideline on how to create rule variables, you need to have knowledge of Decision Table and Scripting Rule
Creating and Managing Rule Variables
Rule Variables are managed in the left panel of the rule editor. Here you can add, edit, or delete variables.

To create a new variable:
Enter a Name (must be unique per rule).
Set a Value (number, text, or boolean).
Click the Save button or click Enter.
Create variable names without spaces and special symbols, even though they are technically allowed.
To edit a variable:
Click the Edit button next to the variable.
Modify the value.
Click the Save button or click Enter.
Save your changes – otherwise, the changed value of the rule variable will not be updated.
To delete a variable:
Click the Delete button next to the variable.
Supported Value Types
Rule Variables support the following data types:
Simple Values

Arrays

JSON Objects

While rule variables support complex objects and arrays, we do not recommend using overly complicated rule variables. Keep variables simple and focused.
What Rule Variables CANNOT Do
Rule variables have important limitations that you should understand:
Reference other values
Rule variables are static values only. You cannot reference one variable from another or perform calculations between them.

While you might think {input.field} syntax would work based on other features, rule variables do NOT support input placeholders. The curly braces are treated as literal text.

Execute functions
Functions stored in rule variables are NOT executed - they are returned as strings.

If you need to use functions, write them directly in table.
How to use Rule Variables
Rule Variables in Decision Tables
There are several ways to use Rule Variables in Decision Table Designer:
As the Column Condition
In the column header, you can use the variable name directly.

As the Comparison Value
In the condition cell, you will see reference with the A prefix

Both approaches achieve the same result - comparing input data against your rule variable. Choose the style that makes your table more readable.
The column header is always the left side of the comparison. When you move a variable between the column header and the condition cell, you must reverse the operator to maintain the same logic.
As Part of the Function
Rule variables can be used inside functions and mathematical expressions, just like any other value (input fields, column values, or static numbers).

This is useful when you want to calculate output without hardcoding them in each cell. If value change, you only update the variable once.
Exactly the same use of Rule Variable applies to Decision Tree.
Rule Variables in Scripting Rule
Usage of Rule Variables in Scripting Rules is super easy. All values are stored in the ruleVariables object that is exposed in the script. You can use these stored values everywhere in the script (as inputs for your function or as inputs for DR.solve() function).
You can access your Rule Variables with the dot notation same as with input and output. To get the value of a rule variable, you write ruleVariables.<nameOfYourRuleVariable>
You cannot set ruleVariables from script itself or overwrite existing Rule Variables.
Last updated
Was this helpful?

