Introduction
- Jobs can be assigned variables from a number of sources.
- Shell Jobs:
- Job Resources holding constant values
- Job Environment Variables populated e.g. from constant values and order variables
- JVM Jobs:
- Initialization Arguments populated from constant values
- Job Arguments populated e.g. from order variables
- Shell Jobs:
- The article explains the sources of variables and the syntax for assignment.
Shell Jobs
Environment Variables from Job Resources
Job Resources can be defined to hold a number of environment variables for shell jobs, e.g. in order to forward environment variables for paths and locations to scripts.
- Environment variables from Job Resources are automatically available for Shell Jobs.
- Environment variables are limited in scope to the current job. Therefore modifications of a job script to an environment variable are not effective beyond the current execution of the job.
- Environment variables use the data type "string".
Job Environment Variables
Shell jobs can define their individual set of environment variables.
- The values of environment variables can be specified from
- Constant values using the "string" data type
- JS7 - Order Variables
- Node Arguments
- Environment variables are limited in scope to the current job. Therefore modifications of a job script to an environment variable are not effective beyond the current execution of the job.
- Environment variables use the data type "string".
JVM Jobs
Initialization Arguments
Job Arguments
Assignment of Variables
The following assignment types are available:
- Constant string values
- This type is used for Variable Declarations with workflows and for Node Arguments
- Example:
- GUI Display:
var1 = value 1
- Storage format:
"var1": "value 1"
- GUI Display:
- Expressions
- This type is used for Environment Variables, Job Arguments and Initialization Arguments
- Example:
- GUI Display:
var1 = $someVariable
- Storage format:
"var1": "$someVariable"
- GUI Display:
Find a number of syntax examples for assigning a variable an expression:
Examples for Constant Values
Constant values are assigned by use of single quotes for an expression. No substitution of variables is performed with single quoted values.
Use with single quotes
Input var = 'some value'
Output some value
Use with double quotes
Input var = "some value"
Output some value
Use with single quoted values
Input var = 'some \'quoted\' value'
Output some 'quoted' value
Use with double quoted values
Input var = "some \"quoted\" value"
Output some "quoted" value
Use with $ character from single quoted values
Input var = 'some $dollar value'
Output some $dollar value
Use with $ character from double quoted values
Input var = "some \$dollar value"
Output some $dollar value
Examples for Variable References
Assignments can reference existing variables. Variables are referenced with a leading $
and optionally with curly braces like this:
$var
${var}
Consider that specifying a non-existent variable will raise a run-time error.
Use without quotes
Assumevar2
to hold the value:some value
Input var = $var2
Output some value
Use with double quotes
Assumevar2
to hold the value:some value
Input var = "$var2"
Output some value
Use with constant values from double quoted values
Assumevar2
to hold the value:second value
Input var = "first value, $var2"
Output first value, second value
Use with string concatenation from double quoted values
Assumevar2
to hold the value:second value
Input var = "${var2}first value"
Output second valuefirst value