Try OpenEdge Now
skip to main content
BPM Events User's Guide
The rule language : Rule structure : Common variables, constants, and their scope : Scope of a value or of a variable
 
Scope of a value or of a variable
The scope of constant values and variables is basically within the bloc {} in which they are declared.
*If a constant value or a variable is declared inside a rule (action part), then its scope of use and visibility is the rule only. Reuse the same symbol in another rule: it refers to a different object.
*If a constant value or a variable is declared inside a finalize {} or initialize {} section, then it is only usable inside this section, and is not visible to rules.
*If a constant value or a variable is declared global, at module level, then it is usable by all rules and sections of this module, and its value has the life span of the module (that is, this value is preserved as long as the module loads).
A global constant value or a global variable is definable at module level, so that it is shared by all the rules. For example, this is the case when a file identifier requires reusing by several rules of a module, for writing into the same file. In such a case, the declaration is done immediately after the module statement, before any rule group.
Example:
application BP_test_suites
module InfopadTest
val outputFile = openFile("e:\\oebpm\\ebmsapps\\BP_test_suites\\rules\\InfopadTest.out");
var taxrate;
group Group1
...