Specifications
Boolean value example
As a second example, the "Include these files" property of a connection leaving a folder allows
a script expression in addition to other filter types:
Select "Define Script Expression" to enter a filter script expression in the property editor, which
looks as follows:
In this case, when it is evaluated in the context of the job being considered as a possible match
for the filter, the script expression should return a Boolean value, i.e. true or false (or a value
that can be meaningfully converted to a Boolean under the JavaScript rules). If the resulting
value is true, the job will be considered to match the filter, otherwise it won't.
Writing a script expression
A script expression is written in JavaScript; other scripting languages are not supported.
The value of a script expression's property is set to the result of evaluating the main body of the
script as an expression. The main body may invoke functions defined in the script expression
itself or provided as part of the Switch scripting API. Also, the script expression can use the
predefined variables "job" and "s" which represent the job and the flow element context at the
moment of script evaluation (see predefined variables below).
You have two options for developing and testing a script expression:
• Enter the script expression directly in the appropriate property editor dialog, as demonstrated
in the previous sections, and test it by activating the flow and processing some sample jobs.
133
Enfocus Switch 10