A variable is a temporary data item that is assigned a default value at the start of rules processing. The variable can be modified by rule actions during processing; other rules can then use it as a condition for triggering certain actions based on its value. The value of the variable is not stored in the database, so it returns to its default value the next time the rules engine begins processing.
Rule variables are useful when you want to accumulate a value and save it conditionally or perform some action based on the accumulated value. A common example of a variable is a score. You can modify a variable based on whether the object being evaluated matches rule conditions. Then you can assign different actions based on the variable’s value.
The actions for each type of variable are listed in the following table.
• Set equal to an absolute value.
• Increment by n.
• Decrement by n.
• Set equal to the value of another integer variable or custom field.
• Set equal to an absolute string.
• Set equal to the value of another character variable or custom field.
• Set equal to an absolute value.
• Increment by n days.
• Decrement by n days.
• Set equal to the value of another date variable or custom field or object date or date/time field.
• Set equal to an absolute value.
• Increment by n days, hours, or minutes.
• Decrement by n days, hours, or minutes.
• Set equal to the value of another date/time variable or custom field or object date or date/time field.
The following procedure describes the steps to add a variable to a rule base or edit an existing one.
To add or edit a variable:
2 Enter the following field information.
Select the variable’s data type. After you have saved a variable, you cannot edit its data type.
Type a value that will be the variable’s initial value every time the rules engine is invoked in the rule base.
Type any note you want to add to the variable; the note will be visible when you mouse over the variable in the tree.