Using Conditional Expressions
Conditional expressions let you define the conditions that must be met for a particular outflow path to be taken or for a specific priority to be assigned to a task. Conditional expressions are necessary when several potential paths can be followed after a gateway or activity.
When you click in the Conditional Expression text box, the Conditional Expression Builder appears. Conditional expressions are written in XPath, a language designed to traverse XML structures. Luckily, you do not need to know XPath to create a conditional expression.
In the Conditional Expression Builder, specify the conditions that must be met for the action to occur. You can create conditional expressions based on:
- Actions taken during a user task. You can specify an action from previous user task based on its label.
- Process Variables. In addition to user task actions, you can create conditions based on the process initiator.
- Field values. You can also use a variable from fields.
Example: An expense report form used in your process contains a "Total Amount" currency field, and you assigned a variable called "total" to this field. You want to route the form to a manager if the total amount is greater than $100, so you create a conditional expression that says, "If total (action) is greater than (operator) $100 (value), take this outflow path."
Note: If you have multiple conditions that must be met for a path, you can insert operators (e.g., "and," "or") into your conditional expressions.
By default, conditional expressions are case-sensitive. Once you've created a conditional expression, you can modify it to make the expression case-insensitive.
Making Conditional Expression Case-insensitive
- Using the Conditional Expression Builder, create a conditional expression that uses the value that should be case-insensitive. The following image shows a match for a single line field to the value "test".
- After building the expression and clicking Insert, the statement for the conditional expression will appear in the text area below the Conditional Expression Builder.
- Edit the statement to fit the following structure: matches(/dataset/attribute_name, "value", "i")
Using Dates in Conditional Expressions
When specifying a date in a conditional expression, you'll need to use the expected date format yyyy-MM-dd (e.g., 2013-12-01).
Converting Strings to Numbers in Conditional Expressions
The values in number and currency fields are automatically treated as numbers when XPath statements are evaluated. If you want the value in a single line field to be evaluated as a number instead of as a string (letters), use the number() function to force the strings to numbers in number variables. For example, if "/dataset/Single_Line" is a string, you can type "/dataset/number(Single_Line)" to force the string to a number.
If you are already using a number, instead of a number variable, be sure to remove quotation marks from the value.
Related Topics