Set conditions
Use conditions to determine the next message or action, based on logical expressions. For example:
- If the user wants to order a ristretto, do not ask for the size (there’s only one size).
- If the user only has one bank account, do not ask for the name of the account.
- If the user is a new customer, go to the part of the dialog where they can set up their profile;
else skip that part. - If a random number is equal to 1, play a specific message;
else if that random number is equal to 2, play another message;
else play yet another message.
You can define conditions in these contexts:
- In a message node, to set variables, to determine which messages to play, or where to go next.
- In a question and answer node, to determine which question to ask.
- In a question and answer node, to determine the actions to perform following the user’s response (for example, set variables, play messages, go to another node).
- In a decision node, to set variables, or to determine where to go next.
- In a question router node, to determine when the dialog should skip collection for an optional entity.
Note that the question router node only supports simple expressions, for skip input conditions. You cannot use complex expressions with logical operators (and, or), in this context. - In a node downstream from the success transition of a data access node, to verify if the expected data has actually been returned—that is, verify that a variable or a complex variable is not equal to
NULL
.
Note:
For variables of type string, conditions that compare a variable againstNULL
also apply to variables with a blank value. For example, given the condition “If userNickname is equal to NULL
” where userNickname is a variable of type string, when the result of this condition is true
, it means that userNickname is either null (no value) or blank (empty value).
Add a condition
The steps you must perform for adding a condition depend on where you want to add it:
- If the condition must be limited to a specific channel, undock the desired channel if it isn’t already, and select it.
- Add a condition placeholder if there isn’t one already.
- Click the condition placeholder.
This opens the condition editor. - Use the condition editor to create your condition.
- Set actions to perform under this condition (for example, assign variables, play a message, throw an event, transition to another node), and add notes to explain your logic, if desired.
Note that what you can add under a condition depends on the node type and context. For example, in the System Question section of a question and answer node, you can only add messages, notes, and conditions.
Tip:
In a node with a complex condition structure, clicking the Table icon expands the Node properties pane giving you a wider area to work with all messages, notes, actions and conditions you need to set. Click the List icon to restore the Node properties pane down to its default width.Once you have created a condition, you can perform various operations directly from the compact condition in the Node properties pane, including:
- Add an else statement
- Add else if statements
- Delete the else statement
- Delete an else if statement
- Delete a condition
- Create a condition around this condition
- Collapse or expand a condition
Add a condition placeholder
- If there aren’t any placeholders yet, click + Condition.
- If other messages, notes, actions, or conditions already exist, click the Add icon , where you want to insert the condition, and choose Condition.
- To add the first placeholder under an existing condition, click the Add icon and choose Condition.
- To add a condition under a condition where other messages, notes, actions, or conditions already exist, bring your pointer to the area where you want insert the condition, click the Add icon that appears, and choose Condition.
Use the condition editor
- Set the desired expression for your condition.
- Click outside the editor to close it.
The compact condition shows the expression you specified.
Set an expression
Note:
In expressions, the operations are evaluated based on the same operator precedence order that is used in JavaScript and Java.- Choose the desired left operand (such as a variable or entity).
Tip: Use the search fields to narrow down the list if needed. If a variable you want to use is missing, you can create it on the fly. - (Optional) Replace the default comparison operator (is equal to) with another one (such as is not equal to, is less than, and so on), if needed.
- Set the desired right operand (for example, choose a variable, an entity, or
NULL
, or enter a static value).
- (Optional) To expand your expression with a logical operation, click the Add icon .
A new row appears, with a logical operator (and) and fields to set another comparison.
Tip: If you need to delete a row, click the Delete icon at the end of the row.
- (Optional) Click the default logical operator, and choose or, if needed.
- Repeat the above until your expression is complete.
Add an else statement
- Bring your pointer to the right-hand side of the condition for which you want to add an else statement.
- Click the More options icon that appears and choose Else statement.
The else statement appears.
- Set actions to perform under the else statement, and add notes to explain your logic, if desired.
Add an else if statement
- Bring your pointer to the right-hand side of the condition for which you want to add an else if statement.
- Click the More options icon that appears and choose Else if statement.
A placeholder for the else if statement appears.
- Click the else if placeholder.
This opens the condition editor.
- Set the desired expression for your else if statement.
- Click outside the editor to close it.
The compact condition shows the expression you specified. - Set actions to perform under the else if statement, and add notes to explain your logic, if desired.
Delete an else if statement
- Bring your pointer to the right-hand side of the else if statement you want to delete.
- Click the More options icon that appears and choose Delete else if statement.
A message appears prompting you to confirm your intention. - Click Confirm.
This deletes the else if statement and all messages, notes, actions, and conditions under it, inside the current condition.
Delete the else statement
- Bring your pointer to the right-hand side of the else statement you want to delete.
- Click the More options icon that appears and choose Delete else statement.
A message appears prompting you to confirm your intention. - Click Confirm.
This deletes the else statement and all messages, notes, actions, and conditions under it, inside the current condition.
Delete a condition
- Bring your pointer to the right-hand side of the condition you want to delete.
- Click the More options icon that appears and choose Delete condition.
A message appears prompting you to confirm your intention. - Click Confirm.
This deletes the whole condition, including any messages, notes, actions, and conditions under the if, else if, and else statements.
Create a condition around a condition
- Bring your pointer to the right-hand side of the condition you want to embed into another.
- Click the More options icon that appears and choose Embed in condition.
Your condition now appears under a condition placeholder.
- Set the desired condition.
Collapse or expand a condition
Click the arrow icon next to the statement you want to collapse in a condition.
Click the arrow icon to expand a collapsed statement in a condition.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.