Create a Global Variable
You can associate variables to a resource.
- Select a resource and open the Sequencing tab.
-
From the commands at the bottom of the panel, click Create a Global Var
.
The Global Variable dialog box appears.
-
Provide the parameters to create a variable of the integer type.
If Array field is empty, it is a simple variable, otherwise it is an array.
This gives the capability to model arrays in a Behavior modeler and access dynamically to data members using evaluated indexes.
Var Array [3];
Array[index] := Array[index-1] + 1;
If (Array[index] == 6) ….
Array definition format:
[ <d1>, <d2>, <d3>, <d4>] (indexing={<d1b>,<d2b>, <d3b>, <d4b>})
Where:
- <di>: is the size of a degree. The maximum number of degrees is limited to 4.
- <dib>: is the 0/1 based indexing. Indexing declaration is optional, and default indexing is 1.
If indexing is declared, declaration must be done for every degree.
Example:
[10]: Array with 1 degree and 10 items. Indexes between 1 and 10.
[2,3]:
- Array with 2 degrees and 6 items.
- Indexes for 1st degree between 1 and; 2.
- Indexes for 2nd degree between 1 and; 3.
[2,3] (indexing={0,1}):
- Array with 2 degrees and 6 items.
- Indexes for 1st degree between 0 and; 1 (0 based).
- Indexes for 2nd degree between 1 and; 3 (1 based).
Default value format:
When a variable is declared as an array, it is possible to give a default value.
The format is similar to C++, using closing and; opening braces.
Example:
[10]: {1,2,3,4,5,6,7,8,9,10}
[2,3] or [2,3] (indexing={0,1}): {{“A”,”B”,”C”},{“D”,”E”,”F”}}
-
Expand the content of Resource Entities and select the
Var tab.
The new variable is listed as a resource entity.