Working with Global Variables
Global variables are accessible to all ProcScript in an application's components, and to global ProcScripts that use the same library or the system library.
Note: Global variables are at risk of being overwritten by multiple components. It is usually preferable to use component and local variables, rather than global variables.
-
To open the global variable editor:
- Click the More Editors and choose Global Variables.
- Select or create a library to hold the variables.
-
To create a new global variable:
- Click New and enter the Variable Name and optional Description.
-
Set the properties for the Data
Type and Display Format.
For more information, see Display Formats.
Global Variables Library Editor - To delete a variable, select it and choose .
-
To save new or modified variables, choose
Alternatively, click OK to save the definition and close the editor.
Global variables are automatically compiled when you save them.
.
-
To reference a global variable in
ProcScript,
-
Prefix the name with
$$
.Note: References to variables are not case sensitive.
- Specify its parent library in the component's Library property or set $variation in ProcScript.
Note: Global variables of Data Type
Handle
cannot be used for accessing operations. Instead, use a component handle on a service. For more information, see Handles.In a large complex application, the risk of several components overwriting the value of global variables increases. When using these variables it is important to clear them when they are no longer required.
For example, for a global variable defined as
SALES_TAX
, it can be referenced as$$SALES_TAX
.$variation = "MyLib" ; specify the parent library $$SALES_TAX = SUBTOTAL.ORDER * <TAX_RATE> ; assign value to global variable TOTAL = SUBTOTAL + $$SALES_TAX $$SALES_TAX = "" ; clear global variable
-
Prefix the name with