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.
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.
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.
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:
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 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:
-
In the dialog editor, click Edit rules to open the rules editor.
-
Enter a name for the Parsing rule name. Every rule has a name which allows you to use the same rule in other dialogs.
Click Add rule to define a new rule.
-
Click Add a rule and then select Use Variable to identify the alternative responses.
-
Define the condition.
-
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.
-
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 rule may have more than one condition. See Response rule conditions for details about defining them and how they are processed.
-
-
Click the then map to field to select the valid option for this rule.
-
(optional) Click Add rule to define another rule for the dialog.
-
Click Save as new to save the rules and add them to the dialog.
-
Click Update Dialog to save the rules to the dialog.
-
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
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.
Response rule operators
A rules operator determines how the response compares to the alternative text in the condition.
| Operator | Match when the response … | Example | Example match response |
|---|---|---|---|
| equal to (=) | … exactly matches the text | message = "y" | y |
| distinct to (!=) | … does not match the text | message != "y" | yes |
| in | … matches one of the word in the text | message in {"y,yes,sure,ok"} | sure |
| not in | … does not match any word in the text | message not in {"n,nope"} | yes |
| contains in | … contains one of the words in the text | message contains in {"y,yes,sure,ok"} | it was ok |
| not contains in | … does not contain any of the words | message not contains in {"y,yes,sure,ok"} | it was good |
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:
To create a group:
-
Define the first condition in the group.
-
Move your mouse pointer over the condition and click the Group Rule control:
This creates the group and adds a new joining operator to apply to the entire group.
-
Set the joining operation for the group to either All or Any.
-
Click Add a rule in the group to add a condition to the group.
-
Continue adding conditions to the group, or to the top-level conditions.
-
Save the rule and dialog and conversation.
