Where to set environment variables
An environment variable can be set in multiple places, inside and outside of Genero Studio. Where and when the environment variable is set is important.
Table 1 shows the locations where you can set the environment variables. The variables in higher-priority locations overwrite those of lower priority; for example, if the same variable is set in both the project and the node, the value in the node is used.
It is recommended practice to use Table 1) where practical. This makes the environment sets easier to reuse and maintain. The disadvantage is that if the project is handed to new users, they must manually re-create the environment set. If portability is more important than reusability, consider setting the variable in the project (rows 1 to 4 in Table 1).
(row 7 inEnvironment variables at the node level (rows 1 to 3 in Table 1) can use predefined node variables.
Priority | Location | How to define | When to set at this location |
---|---|---|---|
1 (highest) | Node | Right-click on the node and select Advanced Properties. Select the Environment variables page and add or edit the User Variables. |
The variable is specific to a node. |
2 |
Node's parents (ancestors) |
Right-click on the parent node and select Advanced Properties. |
The variable is specific to a family of nodes. |
3 |
Dependent node |
Right-click on the dependent node and select Advanced Properties. |
The dependent node requires the variable. |
4 | Project | Add a project-level environment variable. | The variable is used by all nodes in the project for the language. You want the variable to be portable and move with the project. |
5 |
Specific setup |
The variable is used by all configurations which specify the same GSTSETUPDIR. | |
6 |
Global level |
The variable is used for all projects by one user on a single machine. | |
7 |
Environment sets in the Genero configuration |
Select environment set. and then select the |
The variable is used across multiple projects and multiple configurations. You want to define the variable once and re-use it. Recommended option. |
8 (lowest) |
System |
System environment variables cannot be set from Genero Studio. |
These environment variables contain the default values for the system. For further information, see Genero environment variables in the Genero Business Development Language User Guide. |
Order within an Environment Set
Within an Environment Set, arrow keys can be used to change the order of the variables defined. This affects the way the variables are interpreted when the program is executed. For example:
Project level | Variables definition and order | Result when application is executed |
---|---|---|
Project | V1="hello" |
|
Application | V2="$(V1) world"
|
|
Application |
|
|
Example: Priority and Environment Variables
In this example, the program node in the project has a library node as a dependency. The environments have been defined as shown:
Level | Environment Set |
---|---|
System environment |
|
My Library Environment |
|
My Program Environment |
|
If the project directory $(ProjectDir)
is set to
"/home/joe/project
", the environment for the program will be:
PATH=/bin;/usr/bin/;/home/joe/project/scripts
VAR1=goodbye world
VAR2=bonjour goodbye world
VAR3=guten tag