Page History
...
Expressions are a means to dynamically calculate values for variables. Consider that names of variables are case-sensitive.
ExampleExamples:
true
1
"some string"
$variable
$returnCode <= 3
$number + 1
...
The following constant values are supported: true,
false
ExampleExamples:
Expression | true |
---|---|
JSON | "var": true |
...
Strings are written in double quotes. The control characters \t
(tab), \r
(CR) and \n
(NL) are literally written. To suppress its special meaning the $ character is written \$
. No other characters are allowed to follow the \ escape character.
ExampleExamples:
Expression |
|
---|---|
JSON | "var": "\"some value\"" |
...
Addition and Subtraction of two numbers with: +, -
ExampleExamples:
Expression |
|
---|---|
JSON | "var": 1 + 1 |
...
- Similar to a number of Unix shells a variable can be recalled with $ or with ${}.
- Variable names can include dots, however, not at the beginning and not at the end of the variable name and not as a sequence of dots.
- Variable names with dots have to be referenced like this:
$`mail.smtp.host`
,host`
or${`mail.smtp.host`}
If the variable is unknown then an error is raised and the affected Order will fail.
...
Consider that a call to the variable
function will fail if the variable is unknown and no default value is specified.
ExampleExamples:
Expression |
|
---|---|
JSON | "\"variable( \\ \"my_var\\\", job=my_job )\"" |
Comment | The value of the variable my_var is returned as available with the job my_job in a workflow. If the variable is unknown then the function fails. |
Expression |
|
---|---|
JSON | "\"variable( \ \\"my_var\\\", label=my_label, default=\\\"some value\\\" )\"" |
Comment | The value of the variable my_var is returned as available with the job identified by the label my_label in a workflow. If the variable is unknown then the default value some value is returned. |
...
env( "environment-variable", "default" )
- The function reads the value of an existing OS environment variable. The name has to be specified in correct uppercase/lowercase spelling.
- If the environment variable does not exist then an error is raised and the Order fails. Alternatively a default value can be specified.
Examples:
Expression env( ('JS7_AGENT_CONFIG_DIR')
JSON "env( 'JS7_AGENT_CONFIG_DIR' )"
Sample Value /var/sos-berlin.com/js7/agent/var_4445/config
Expression env( 'JAVA_HOME', '/usr/lib/jvm/java-1.8-openjdk' )
JSON "env( 'JAVA_HOME', '/usr/lib/jvm/java-1.8-openjdk' )"
Sample Value /usr/lib/jvm/java-1.8-openjdk
Expression env( 'HOSTNAME', env( 'COMPUTERNAME' ) )
JSON "env( 'HOSTNAME', env( 'COMPUTERNAME' ) )"
Sample Value 2021-05-03 07:30:42
now( format='yyyy-MM-dd hh:mm:ss', timezone='Europe/Berlin' )
- The job start date. This date can be formatted using Java date qualifiers. Optionally a time zone can be specified, by default the UTC time zone is used.
Examples:
Expression now( format='yyyy-MM-dd' )
JSON "now( format='yyyy-MM-dd' )"
Sample Value 2021-05-03 Expression now( format='yyyy-MM-dd hh:mm:ss' )
JSON "now( format='yyyy-MM-dd hh:mm:ss' )"
Sample Value 2021-05-03 07:30:42 Expression now( format='yyyy-MM-dd hh:mm:ssZ', timezone="Europe/Berlin" )
JSON "now( format='yyyy-MM-dd hh:mm:ssZ', timezone=\"Europe/Berlin\" )"
Sample Value 2021-05-03 09:30:42+02:00
scheduledOrEmpty( format='yyyy-MM-dd hh:mm:ss', timezone='Europe/Berlin' )
- The date for which an orders is scheduled.
- The date formatting options are the same as explained with the
now()
function.
...