Page History
...
Expressions are a means of dynamically calculating values for variables. Note that the names of variables are case-sensitive.
Examples:
true
1
"'some string"'
$variable
$returnCode <= 3
$number + 1
...
<variable>
is a string expression for the name of the variable.label=<label>
(optional) is the label of an instruction for which the variable is recalled. Note that the label is not quoted. Example:label=A
.job=<job>
(optional) is the name of a job for which the variable is recalled. Note that the job name is not quoted. For example:job=MYJOB
.- label and job cannot be specified at the same time
default=<default>
(optional) specifies the default value if the variable does not exist.
Note that a call to the variable
function will fail if the variable is unknown and a default value has not been specified. This function cannot be used within a Job Resource.
Examples:
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. |
...
jobResourceVariable( string: <JobResource>, string: <Variable> )Anchor function_jobresourcevariable function_jobresourcevariable - The function provides access to JS7 - Job Resources: it reads from the Job Resource specified with the first argument and returns the value of the Job Resource variable specified with the second argument. The function is evaluated by the Controller when adding an order. It is therefore not necessary to specify the requested Job Resource outside of the function. In fact the Controller reads the relevant variable values from the Job Resources indicated and adds them to an Order Variable that is considered final and cannot be modified later on.
- This function can only be used with the variable declaration of a workflow. It cannot be used , with later job arguments, node arguments or and environment variables. When declaring used with the declaration of an order variable with the workflow then the
final
data type has to be used. Examples:
Expression jobResourceVariable( 'database', 'db_user' )
JSON "jobResourceVariable( 'database', 'db_user' )"
Sample Value scott
Expression jobResourceVariable( 'database_' ++ $country, 'db_password' )
JSON "jobResourceVariable( 'database_' ++ $country, 'db_password' )"
Sample Value tiger
This example dynamically specifies the name of the Job Resource by concatenating the fixed value
'database_'
and the value of the$country
order variable.
...
JobResource:<JobResource>:<Variable>
- The function returns the value of the specified
<Variable>
from the given<JobResource>
. This function cannot be used within a Job Resource. - Note the shorthand syntax which 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>Anchor function_tofile function_tofile - The function returns the absolute path to a temporary file which holds the value of the specified
<Content>
. This can be a constant string or a variable of type string. - The file path is determined by the Agent using 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 and where these 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. This can then be processed using, for example, 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 which holds the value of the specified
...