User Guide : Scripting : Variables : Managing Variables
 
Share this page             
Managing Variables
You can use variables to refer to values or expressions in scripts. You can declare variables in a map or a process. Public variables with the variant data type appear in the Configuration tab. However, if you later change the initial value or delete one of these variables from the process or the map, the changes are not updated in the Configuration dialog.
Tip...  You can also declare variables with scripting. Use the Dim keyword to declare a local variable. Scope variables with the Public and Private keywords.
You can add new variables to a map or process or import variables from another map or process. After you add or import variables, add them in a script. For more information, see Scripting.
You can do the following for global variables:
Adding Global Variables
To add a global variable to a map or a process
1. In the map or process file, go to the Configuration tab > Global Variables section.
2. Click /download/attachments/25953900/image2017-3-29%2015%3A56%3A10.png?version=1&modificationDate=1490820970471&api=v2 to add a global variable.
The Add Global Variable window is displayed.
3. Specify the required fields or options as provided in the following table.
Field or Option
Description
Variable Name
Unique name for the variable.
Variable Type
From the drop-down list, select the type of variable:
DOMDocument
DOMNode
DJExport
DJField
DJImport
DJMessage
DJComponent
DJRecord
DJRowSet
JavaObject
JavaVM
Object
Variant
Public
Select this option to make the variable public. Else, clear this option (that is, private). By default, it is selected.
Note:  For variables of the Variant data type, you must select Public for the variable to appear in the configuration.
Array
If you select the type as Variant, then this option is enabled and you can specify dimensions for the array.
To do this, click Add. Dim1 is displayed in the Dimension column.
Click in the Lower Bound and Upper Bound fields. Type the value for the lower bound and upper bound for each dimension of an array variable.
To remove a dimension, click the dimension and click Remove.
For more information, see Array Variables.
Initial Value
Initial value for the variable. Available only for variants.
Description
Description for the variable.
4. Click Add.
The global variable is displayed in the Global Variables section.
Editing Global Variables
To edit a global variable
1. In the map or process file, go to the Configuration tab > Global Variables section.
2. Click the global variable that you want to edit and then click /download/attachments/25953900/image2017-3-29%2015%3A58%3A59.png?version=1&modificationDate=1490821138938&api=v2.
The Edit Global Variable window is displayed.
3. Modify the required fields and options.
For information about the fields and options, see Adding Global Variables.
4. Click Save to save the changes.
Importing Global Variables
Import an existing variable to save time. Importing a variable adds the variable to the global variable list for the current artifact. This public variable is declared and instantiated, so that you do not have to do this in the code. After you import, you can edit the variable if required.
To import a global variable
1. In the map or process file, go to the Configuration tab > Global Variables section.
2. Click the /download/attachments/25953900/image2017-3-29%2015%3A59%3A18.png?version=1&modificationDate=1490821158626&api=v2 icon.
3. Specify the file that you want to import and click Open.
After importing a process designer file, all the global variable present in the file are added to the Global Variable list.
Note:  If you attempt to use an unavailable variable when scripting, an undefined variable error appears. Ensure the variable exists and then import it into your map or process.

An alert message appears if the imported process files does not contain any global variable.
Deleting Global Variables
To delete a global variable
1. In the map or process file, go to the Configuration tab > Global Variables section.
2. Click the variable that you want to delete and click /download/attachments/25953900/image2017-3-29%2015%3A59%3A41.png?version=1&modificationDate=1490821180872&api=v2.
A message asking for confirmation is displayed.
3. Click Yes.
The selected variable is deleted from the Global Variables section.