Introduction
- Variables can be used to parameterize workflows and jobs.
Scope
- Variables are declared with a Workflow.
Declaring Variables
The JS7 - Workflow Editor offers the icon with the property editor to declare variables:
A popup window opens that offers to declare variables:
Explanations:
- Variables are declared by specifying a name and data type.
- If no default value is added then the Variable is mandatory, i.e. any Orders have to specify a value for the Variable.
- If a default value is added then the Variable is optional, i.e. Orders can specify a value and otherwise the default value is used.
- Any number of Variables can be declared.
Using Variables
Variables can be used in a number of places:
- to populate environment variables that are used in job scripts,
- to populate node arguments,
- to be evaluated with an expression of a JS7 - If Instruction
Using Variables in Shell Jobs
Shell jobs can access Variables by use of environment variables.
Mapping Variables to Environment Variables
A mapping is performed with the "Environment Variables" sub-tab of the Job property editor:
Explanations:
- The property editor suggests to use the names of Variables for environment variables.
- Environment variable names are automatically converted to uppercase letters.
- Similarly the values of Variables are suggested with a $ prefixing the Variable name.
- Consider that only names of existing Variables can be used as the value for an environment variable.
Using Environment Variables with Job Scripts
Environment variables can used with Job scripts considering the syntax of the respective operating system that the Job is executed for:
- for Windows use:
%VAR_STRING%
- For Unix use
$VAR_STRING
${VAR_STRING}
Using Node Arguments
Node Arguments typically are used in a situation when the same job occurs more than once in a Workflow. The basic assumption is that the Job will make use of the same Variables that should use different values per node in which the Job is used. To this purpose a