A Global Variable is an object that variablizes an otherwise static input parameter. For example, you could use one Global Variable in place of a file path in multiple objects. Using a Global Variable instead of a path lightens the workload when/if a location changes.
A Global Variable can represent the following:
- File
- File path
- URL path
- System property
- Email address
- Host name
- Part of a path
Global Variables can be used as parameters in several objects, including the Cloud Monitor and Data Source.
They are exceptionally useful for unexpected changes. If you have to move all your files or architecture to a different folder or different machine, it's far more efficient to change a few Global Variables as opposed to a hundred individual files or URL paths.
If they can be used across multiple projects, Cleo recommends creating Global Variables in a CORE Project, so the object can easily be shared with other Projects. This is useful for multiple Projects that refer to the same folder or database, an administrator email address, etc.
A Global Variable can contain another Global Variable.
Business Use
It is a best practice to use Global Variables instead of specific paths when multiple objects refer to the same path, just in case you must move things later on. This also has an immediate, practical use with testing.
For example, suppose you have test server C: and production server D:
- When testing, all your path parameters point to C:
- When you move to production, you would have to go into the objects that refer to C: and change each parameter to D:. However, if you refer all those objects to a single Global Variable, you only need to change the path to D: on a single Global Variable.
A Global Variable can also represent a portion of a path name.
For example, you could set up a Global Variable, <Desktop.globalVar> and then abbreviate this path:C:\Users\ExtolUser\Desktop\FFfolder
as this:<Desktop>FFfolder
How the Object Works
Global Variables can also be used to define other Global Variables.
They are tracked in Admin Console | Settings.
If you want to use a Global Variable from one Project in another Project, you must enable sharing between those Projects.
How to define
Define a Global Variable to tell it which file or URL path to use.
- In the Global Variables editor, click the Add button.
- In the New Global Variable window, type DbName in the Variable Name field and xdb1 in the Replacement Value field.
- Click OK to close that window.
- In the Global Variables editor, click the Add button.
- In the New Global Variable window, type a Variable Name.
- In the Replacement Value parameter, specify the file or URL path, either literally or using variables. Options are:
- Insert existing variable name - Refer to another Global Variable or use another Global Variable as part of the path.
- Browse for a directory - Choose a specific directory.
- Browse for a file - Choose a specific file.
- Browse system properties - Choose a specific system properties key. This will also automatically select the Use System Property checkbox.
Note: If you want to use a system property that is not available by browsing, select the Use System Property checkbox and type the property name in the Replacement Value parameter manually.
-
(Optional) There are two reasons you may want to select the Use System Property check box. One is detailed in the previous step.
The other is in case your operating system needs to insert a "/" or "\" into your variable value during runtime. For example, suppose you create a Global Variable named Separator with the value "file.separator". If Use System Property is selected, the value for that variable is resolved at runtime to a “/” or “\” depending on your operating system. If Use System Property is not selected, then the value will be the string “file.separator”.
- Click OK.
- In the Perspective Toolbar, click Save.
Comments
0 comments
Please sign in to leave a comment.