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.

Note:

It is recommended practice to use Tools > Genero Configurations > Environment sets (row 7 in 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).

Note:

Environment variables at the node level (rows 1 to 3 in Table 1) can use predefined node variables.

Table 1. Setting environment 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

Add a specific setup-level environment variable.

The variable is used by all configurations which specify the same GSTSETUPDIR.
6

Global level

Add a global-level environment variable.

The variable is used for all projects by one user on a single machine.
7

Environment sets in the Genero configuration

Select Tools > Genero Configurations and then select the environment set.

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:

Table 2. Variable interpretation examples
Project level Variables definition and order Result when application is executed
Project V1="hello"
Application V2="$(V1) world"

V1="goodbye"

V1="goodbye"

V2="hello world"

Application

V1="goodbye"

V2="$(V1) world"

V1="goodbye"

V2="goodbye world"

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:

Table 3. Environment Set for levels used in the example
Level Environment Set
System environment
PATH=/bin;/usr/bin 
VAR1=hello 
VAR2=bonjour 
VAR3=guten tag
My Library Environment
PATH=$(PATH);$(ProjectDir)/scripts 
VAR1=goodbye
My Program Environment
PATH=$(PATH);$(ProjectDir)/scripts 
VAR1=$(VAR1) world 
VAR2=$(VAR2) $(VAR1)

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