Rule Variables
Rule variables are used to simplify the editing of a large amount of data.
Rule Variables in Decision Tables
How to create Rule Variables
Settings of Rule Variables could be found in the middle of the page of Rule Settings in DecisionTables.
Rule variables are bonded with the version of the Ruleset.

When you want to create new variable, click to the button , so the Rule Variables table will show up. Then write a name of the variable, specify its value and hit the button
. In case the variable is not useful, you can delete
it or rewrite its value
.

Examples of Rule Variables
Ticket_price 350
City Rome
city_tax 5
Value of the Rule Variables
The name of the variable has to be always unique, otherwise, the variable cannot be saved. The format of the value could be TRUE/ FALSE, text or number. It is not possible to use the objects, for example, the empty set.
Each time save your changes – otherwise, the changed value of the rule variable will not be updated in Decision Table Designer.
How to use Rule Variables
There are many ways how the rule variables could be used in the Decision Table Designer. The variables could be used in the input, the same as in the output.
A single value in the condition
Rule Variables in the functions
Rule Variables in the text
Single value in Conditions

After clicking on the button, the window with predefined rule variables will show up. Select there the variable you want to you and save.
Rule variables in the functions
Rule Variables can be applied while using the function during counting as you can see in the column Final Price.

Rule Variables in the text
Another possible manipulation with Rule variables is to display the name od Rule variables in the text/ message.

Test of created rules
In the last step, a test created rules in Test Bench. Before testing the rule, we must change the status of the decision table to "Published" or have to debug mode ON. Debug mode allows you to test rules even when it is pending and at the same time writes data information to the debug mode console.
Input model Example

Output model Example

Request body example
Response body example
Rule Variables in Scripting Rules
How to create Rule Variables
Settings of Rule Variables could be found in the middle of the page of Rule Settings in Scripting Rules.

How to use Rule Variables
In comparison with Decision Table, the use of Rule Variables is simpler and faster. No wonder! Instead of clicking on buttons you are specifying the actions and functions in JavaScript.
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>
E.g. ruleVariables.test

Steps to follow:
Create an Input and Output model
Create rules in Scripting Rule Designer
Rule Variables are used the same way as Input/Output variables. The only difference is that the value of Rule Variables is fixed, and can be collectively updated in whole your code.
Test created scripting rule.
Last updated
Was this helpful?