While configuring the rule engine, it might be useful to integrate variables. For example, to perform a count, to store current index in a loop, etc…
3 Addons allow to define a variable:
- DEF: Dedicated to this purpose.
- FOREACH: 2 variables might be defined: current item an index.
- FOREACHNUMBER: 2 variables might be defined: current item an index.
- EXEC: Exit code is stored in a variable.
These Addons are given the variable name as a parameter. It may be accessed later by prefixing this name with the « $ » character.
In addition to local variables, globales ones are natively available for all exécutions. They must be prefixed by the « # » character to be accessed. Here is the list:
- DATE: Current date.
- DATETIME: Current date + time.
- TIME: Current time (as Java Runtime before 1.8 does not integrate time representation, a standard Date is used, with date components reset to the “zero epoch”).
- NOW: Alias for datetime.
- NULL: The Java “null” value.
- RULESETNAME: Rule set name.
- READBASE: Forces access to current context write base.
- WRITEBASE: Forces access to current context read base.
- ROOTREADBASE: Forces access to root context read base. This is useful when using sub-properties (in collection filtering for instance). If current context is the root context, then ROOTREADBASE is equivalent to READBASE.
- ROOTWRITEBASE: Forces access to root context write base. This is useful when using sub-properties (in collection filtering for instance). If current context is the root context, then ROOTWRITEBASE is equivalent to WRITEBASE.