Page History
...
env( string: <environment-variable>, string: <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 an optional 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
This example assumes the
$HOSTNAME
environment variable to be available for Agents running on Unix or the%COMPUTERNAME%
environment variable to be available for Agents with Windows.
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
...
JobResource:<JobResource>:<Variable>
- The function returns the value of the specified
<Variable>
from the given<JobResource>
. - Consider the shorthand syntax that does not use brackets
Examples:
Expression JobResource:database_uk:db_user
JSON "JobResource:database_uk:db_user"
Sample Value scott
Expression JobResource:database_uk:db_user orElse 'scott'
JSON "JobResource:database_uk:db_user orElse 'scott'"
Sample Value scott
This example reads the
db_user
variable from thedatabase_uk
Job Resource. If the variable does not exist then the default value'scott'
is used.
- The function returns the value of the specified
toFile( string: <Content>, string: <FileSpecification>
- The function returns the absolute path to a temporary file that holds the value of the specified
<Content>
which can be a constant string or a variable of type string. - The file path is determined by the Agent that makes use of its
JS7_AGENT_DATA/work/values
directory and a temporary sub-directory. - The
<FileSpecification>
. is used to determine the file extension, for example *.xml. - The function can only be used with JS7 - Job Resources and JS7 - Jobs.
- Typical use cases include a situation when longer values for job resource variables or order variables are used that would be truncated when exposed as environment variables in shell jobs. In this situation the variable's value can be written to a temporary file and the job's environment variables receives the path to the temporary file that can be processed for example with OS commands.
Examples:
Expression toFile( 'some long string value', '*.txt' )
JSON "toFile( 'some long string value', '*.txt' )"
Sample Value /home/sos/agent/var_4445/work/values/0/32.txt
- The function returns the absolute path to a temporary file that holds the value of the specified
Further Resources
...
Overview
Content Tools