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.

Add a condition

The steps you must perform for adding a condition depend on where you want to add it:

  1. If the condition must be limited to a specific channel, undock the desired channel if it isn’t already, and select it.
  2. Add a condition placeholder if there isn’t one already.
  3. Click the condition placeholder.

    This opens the condition editor.
  4. Use the condition editor to create your condition.
  5. 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.

Once you have created a condition, you can perform various operations directly from the compact condition in the Node properties pane, including:

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

  1. Set the desired expression for your condition.
  2. Click outside the editor to close it.
    The compact condition shows the expression you specified.

Set an expression

  1. 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.
  2. (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.
  3. Set the desired right operand (for example, choose a variable, an entity, or NULL, or enter a static value).
  4. (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.
  5. (Optional) Click the default logical operator, and choose or, if needed.
  6. Repeat the above until your expression is complete.

Add an else statement

  1. Bring your pointer to the right-hand side of the condition for which you want to add an else statement.
  2. Click the More options icon that appears and choose Else statement.

    The else statement appears.
  3. Set actions to perform under the else statement, and add notes to explain your logic, if desired.

Add an else if statement

  1. Bring your pointer to the right-hand side of the condition for which you want to add an else if statement.
  2. Click the More options icon that appears and choose Else if statement.

    A placeholder for the else if statement appears.
  3. Click the else if placeholder.
    This opens the condition editor.
  4. Set the desired expression for your else if statement.
  5. Click outside the editor to close it.
    The compact condition shows the expression you specified.
  6. Set actions to perform under the else if statement, and add notes to explain your logic, if desired.

Delete an else if statement

  1. Bring your pointer to the right-hand side of the else if statement you want to delete.
  2. Click the More options icon that appears and choose Delete else if statement.

    A message appears prompting you to confirm your intention.
  3. 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

  1. Bring your pointer to the right-hand side of the else statement you want to delete.
  2. Click the More options icon that appears and choose Delete else statement.

    A message appears prompting you to confirm your intention.
  3. Click Confirm.
    This deletes the else statement and all messages, notes, actions, and conditions under it, inside the current condition.

Delete a condition

  1. Bring your pointer to the right-hand side of the condition you want to delete.
  2. Click the More options icon that appears and choose Delete condition.

    A message appears prompting you to confirm your intention.
  3. 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

  1. Bring your pointer to the right-hand side of the condition you want to embed into another.
  2. Click the More options icon that appears and choose Embed in condition.

    Your condition now appears under a condition placeholder.
  3. 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.