Response rules

Response rules map invalid respondent responses to valid Multiple Choice Dialog options. Use response rules to catch alternative responses to the intended response. For example, consider a question that asks the respondent to rate an experience, and the valid options are Poor, Good, and Great. If the respondent's dialog response is "bad", it will not map to a valid option.

Illustration of "bad" being a mismatch to the valid options Poor, Good, and Great

Response rules define how alternative responses (like "bad") map to valid options (like Poor). In this example, the rule could read:

when message = "bad" then map to Poor

Click Edit rules to open the rules editor. See Creating a new rule (below) for an example of using the editor.

Edit rules button on the dialog editor

Every dialog type that expects a response from respondents can have set of response rules. Dialogs may have their own set of rules, or they can share rule sets. Either enter the name of the new rule set, or select the existing set to use.

Two options: name a new rule or select an existing one

A dialog can have one or more rules, each defining mappings to different valid options. When there are multiple rules, click on the rule in the editor to select the one to edit. This editor has two rules:

Response rule editor with two rules: one for a 'Yes' option and one for a 'No'

Delete a rule by clicking the X in the upper-right corner of the rule. The X only appears when you move the mouse pointer over the corner.

The delete 'X' appears on the upper-right corner when you point to the rule

The rest of the discussion covers how to create and edit rules, and provides details about rules and working with them:

Creating a new rule

Every rule has at least one condition that identifies at least one alternative response, and a mapping to the valid option. This example creates this simple rule:

when message = "bad" then map to poor

To create the rule:

  1. In the dialog editor, click Edit rules to open the rules editor.

    Edit rules button on the dialog editor

  2. Enter a name for the Parsing rule name. Every rule has a name which allows you to use the same rule in other dialogs.

  3. Click Add rule to define a new rule.

  4. Click Add a rule and then select Use Variable to identify the alternative responses.

    Choose 'Add Variable' after clicking 'Add a condition'

  5. Define the condition.

    1. Each condition has an operator that determines how the response compares to the text values(s) in the condition. See Response rule operators for descriptions and examples of the operators.

    2. Provide the text value(s) that matches the alternative response(s).

    This example can be read as, "when the response contains 'poor' or 'bad', map the response (to the valid option for the rule)":

    A 'contains in' operator with a text value of 'poor,bad'

    A rule may have more than one condition. See Response rule conditions for details about defining them and how they are processed. 

  6. Click the then map to field to select the valid option for this rule.

    Clicking 'then map to' opens a drop down of the valid options for this dialog

  7. (optional) Click Add rule to define another rule for the dialog.

  8. Click Save as new to save the rules and add them to the dialog.

    'Close' closes the editor and saves the changes

  9. Click Update Dialog to save the rules to the dialog.

  10. Click Save to save the conversation.

Response rule conditions

A rule condition identifies when the response matches an alternative response. In this example, the condition is message="ok":

when message = "ok" then map to Yes

Every condition is a comparison of the response — the message — and the possible alternative value(s). How the response and values compare depends on the operator. In the example above, the operator is "equals" (=). There are, however, several possible comparison operators. See Response rule operators for detailed descriptions and examples of the operators. 

Rules can be complex with multiple conditions, but there is only one result per rule. For example, this rule has two conditions, and if either is true the response maps to "Yes":

when message = "ok" or message = "y" then map to Yes

Tip: Avoid overly complex conditions; they are an indication the question is vague. Don't try to catch every possible answer; instead, prompt the respondent how to answer. For example, "Was the sushi fresh (Y/N)?", and then look for 'yes', 'y', 'no', and 'n' in the responses.

When a rule has multiple conditions, they either all have to be true (AND) or any one can be true for the mapping to occur (OR).

  • All uses a logical AND to join the conditions: map only when every condition must be true

  • Any uses a logical OR to join the conditions: map when any of the conditions is true

Choose the joining-operator when you define the rule and it will automatically be applied to all conditions.

The joining operator is a dropdown whose options are All or Any

Note: When the rule has a single condition, the joining operator has no meaning: you can choose either All or Any.

Response rule operators

A rules operator determines how the response compares to the alternative text in the condition.

OperatorMatch when the response …ExampleExample match response
equal to (=)… exactly matches the text message = "y"y
distinct to (!=)… does not match the textmessage != "y"yes
in… matches one of the word in the textmessage in {"y,yes,sure,ok"}sure
not in … does not match any word in the textmessage not in {"n,nope"}yes
contains in… contains one of the words in the textmessage contains in {"y,yes,sure,ok"}it was ok
not contains in… does not contain any of the wordsmessage not contains in {"y,yes,sure,ok"}it was good
Note: All operations are case-insensitive. The response can be YES, Yes, or yES, and all will match 'yes'.
Tip: In practice, IN and CONTAINS IN are generally better choices than EQUAL TO because the later requires one condition for each possibility, while others require just one condition that contains all the possibilities.

Complex rules

Complex rules are one with multiple conditions that each can be used to map responses to the valid option. This rule has two conditions where if either is true (OR) then map the response to Yes:

when message = "ok" or message = "y" then map to Yes

Multiple conditions can be grouped to specify an order of operation, and to indicate a set of conditions whose result can be compared to other conditions. This rule groups two conditions such that both must be true (AND) for the group to be true, then the group is compared to the remaining to conditions. The group is in parentheses:

message = "y" or (message="ok" and message != "not ok") or message = "sure"

In the response editor, the rule above looks like this:

Response rule editor defining the example expression with an inner group and two additional conditions

Tip: Avoid complex response rules. Overly complex response rules are an indication the question is vague. Don't try to catch every possible answer; instead, prompt the respondent how to answer. For example, "Was the sushi fresh (Y/N)?", and then look for 'yes', 'y', 'no', and 'n' in the responses.
Tip: As you define a rule, the Rule definition field show the text description of the rule logic. Use it to confirm the order of operation.

The 'Rule description' field shows the rule logic

To create a group:

  1. Define the first condition in the group.

  2. Move your mouse pointer over the condition and click the Group Rule control:

    Click 'Group rule' to collect the group

    This creates the group and adds a new joining operator to apply to the entire group.

  3. Set the joining operation for the group to either All or Any.

  4. Click Add a rule in the group to add a condition to the group.

    Click 'Add a rule' for the group to add a condition to the group

  5. Continue adding conditions to the group, or to the top-level conditions.

  6. Save the rule and dialog and conversation.