A new OpenRules Release 6.3.0 introduced “macro” to simplify an access to decision variables. For example, you may write a formula like below
Here macros ${Greeting} and ${Salutation} will be replaced to the actual values of the proper decision variables to assign to the variable “Result” something like “Good Afternoon, Mrs. Robinson!”.
Macros ${variable name} are used to get the current value of the proper decision variables of the type String. For other types of variables you need to add one more letter between ‘$’ and ‘{‘ as described in the following table:
For example, in the formula
macro $R{…} are used for real variables and $I{Extra} for the integer variable “Extra”. If a user uses an invalid type, the proper warning will be produced.
The reason we force a used to specify a variable type is justified by the fact that OpenRules will recognize the actual types of variables only during a decision’s run (and not when it is created). For example, if you use a decision variable “Amount” inside expressions like “Amount < 1000“, OpenRules only requires that the type of the variable”Amount” supports the comparison operator “<” but the actual type could be either integer or real. Moe than that, you may even change the variable types between different runs of the same decision.
There is an alternative (even simpler) way to refer to a decision variable of the type String when it represents the entire content of an Excel cell. For example, instead of the formula
::= ${Selected Airline}
you may simply write
$Selected Airline
Similarly, for a list of strings you may put in your decision table cell something like this:
United, $Selected Airline, Delta
and $Selected Airline will be replaced by its actual value.
Read more about the OpenRules expression language at the User Manual on the page 19. As macros can be freely used inside Java snippets, we expect that they will make OpenRules expressions much more friendlier for business users.