Was this helpful?
Decision Step
The Decision step allows you to evaluate a conditional expression and make logical choices between true and false process paths This can be done in the following two ways:
Using a Boolean expression - A Boolean expression is a logical statement that is either TRUE or FALSE. For example, the following expression evaluates as TRUE if the month is September and FALSE for all other months:
Month(Date()) == 9
If the expression is TRUE, then the true branch of the process is followed. If it is FALSE, then the false branch is followed. It is possible to have multiple true or false branches.
Using an expression that evaluates to a number - If the expression evaluates to zero, the process treats it as FALSE. Any other number (negative or positive) is treated as TRUE.
Note:  If the expression returns a string, the step fails and the process is stopped. Additionally, the string returned by the expression is displayed as the step result (error message) and written to the log file.
If you have a multi-threading engine, then the selected branches can be executed in parallel. If not, they are executed in random order. In either case, the process executes all paths that match the expression results before proceeding to the next step in the process.
Things to remember:
A string of characters must be enclosed in quotation marks (").
A string of characters not enclosed in quotation marks (") is evaluated as a variable name, function name, or keyword.
Non-numeric strings and undefined variables evaluate to FALSE.
True and False (case-insensitive) are keywords and must not be enclosed in quotation marks (").
Functions can be used if they return a boolean, numeric, or string value. Functions that do not return a value generate a run-time error.
A valid expression that does not resolve to TRUE or FALSE, a select statement for example, generates a validation warning.
A Decision step must have at least one true and one false path to be valid and to prevent infinite looping. The only true path or only false path cannot be a path back to the Start step, otherwise the process is not valid and you may receive an error.
To test a value from a script that was executed in a different step, you need to set a variable, macro, file, etc. that gets tested in another step.
To add a Decision step:
1. Drag and drop a Decision step () from the Palette to the canvas.
2. Double-click the step on the canvas to see the step properties.
3. Type a unique Name and small Description for the step.
4. Add an Expression for the Decision step. For information about how to use Script Editor to build a Decision step expression, see Building Decision Step Expressions.
5. Link the Decision step with other steps. For more information, see Linking Steps.
When you link the Decision step, you will be prompted to select TRUE or FALSE. These options dictate the paths for the process. When the process is executed and the expression inside the Decision step is evaluated, the process follows the true or false path.
6. Add any additional logic to the expression.
7. To check for syntactical errors, click the Validate icon. Address any errors in your script.
8. Once you have created a valid expression, click the Save icon.
Note:  For more information about adding steps, see Adding Steps.
Decision Step Properties.
Property Name
Description
Name
Unique name for the step.
Description
Description for the step
Expression
Type the expression to evaluate in the text box or click Open to open the EZscript Expressions window and specify the expression.
Examples
The following examples show how to define Decision steps based on properties returned by other steps:
'If Initial_Test succeeds and Map_001 fails with a return code of 25009, this script returns True.
Project("Initial_Test").Status == "Completed" And Project("Map_001").ReturnCode == 25009
'If Import_Steps returns no errors, this script returns True.
Project("Import_Step").ErrorCount == 0
'The following code checks if encoding of message (“msg1”) is set to ISO 8859-1.
msg1.Encoding == ENC_ISO8859_1
'The following code checks if the message property Parts has string value of "22".
msg1.Properties("Parts") == "22"
'The following code checks if the has a Binary payload.
if srcMsg.binary == true
Last modified date: 02/09/2024