Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 2 Composition of a Rule : Handling Dynamic Data Values

Handling Dynamic Data Values
Declaring Local Variables
You use local variables to hold dynamic data values. If your rule makes use of dynamic data values, declare the local variables that you require below the rules header.
Sample Local Variable
The following example shows the rules declaration containing the rule name and argument list, the local variables RAISE and RATE, and the assignment of a value to the local variable RATE:

 
RULE EDITOR ===>
EMPLOYEES_RAISE(JOBTITLE, REGION);
LOCAL RAISE, RATE;
_ ---------------------------------------------------------------------------
- ..... |
- ----------------------------------------------------------------+----------
- RATE = 0.1; |
.....

 
Valid Values
The declaration begins with the reserved word LOCAL and ends with a semicolon (;). If you have more than one local variable, they are separated with commas.
A local variable can be assigned an arithmetic value or a string. The maximum value or string length that can be assigned to local variables during a session is determined by the session attributes.
Scope of Local Variables
The scope of a local variable is the rule where it is declared and any descendant rules (rules that are below the rule in the calling hierarchy). They can be used anywhere in an action, except to supply a value for an indirect reference. For more information about indirect references, refer to Indirect Referencing.
Data Representation of Local Variables
The following rules apply to the data representation of a local variable:
If the variable is assigned a literal value in a rule (for example, variable=12;), no semantic type is assigned, only a syntax.
If the variable is assigned a literal value in a rule and the concatenation operator is used (for example, variable = ‘a’ || ‘b’;), a string (S) semantic data type is assigned.
For more information about syntax and semantic data types, refer to Syntax of Data Elements and Semantic Data Types.
Initial Behavior of a Local Variable
Before a value is assigned to a local variable, it behaves as:

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved