In survey creation, it’s often helpful to be able to skip questions or go to different questions based on the participant’s previous answers. For instance, in a survey about smoking, you may wish to skip most of the questions if the participant says they have never smoked.
There are two kinds of navigation rules. The first allows you to skip the current step based on the participant's previous answers. The second allows you to control which step is next when the current step is completed.
Skipping the Current Step
You can add a skip rule to any step. If the conditions are met, the survey will skip over that step and immediately go to the next one. To set up a skip rule:
- Select the step in the survey editor.
- Go to the Navigation tab.
- Under "Skip this step..." select either "Never" or "If a condition is met."
- Select a previous question, and the answer(s) that will cause the step to be skipped. Depending on the question type, you will be able to select specific values, or ranges like "is greater than...".
You can enter any number of conditions, and even combine and negate conditions using AND, OR, and NOT to create complex logic. See Compound Conditions below for more information.
Controlling the Next Step
You can also select from several options of where to go when the step is completed:
- Go to the next step
- Go to a specific step
- Go to steps depending on previous answers
“Go to the next step” is the default for all steps and will send the participant to the next step in the sequence. “Go to a specific step” lets you choose a specific step to send the participant to.
“Go to steps depending on previous answers” lets you set up complex conditional logic to send them to steps depending on their answer to the current (or previous) questions.
To create a branching survey in the survey editor, go to the navigation tab for the step you would like to branch from.
When you’ve selected “Go to steps depending on previous answers” you will be presented with a button that allows you to add a navigation rule. Clicking the button displays the “Edit Navigation Rule” dialog:
You can then set up a condition. For instance, if the step “
E_SMOKE” has the answer “NO”, you can choose a step for the participant to go to if the condition is true—for instance, “
This will send the user to the “
INSTRUCTION_THANKYOU” step if the user has answered “NO” to the “
You can set up as many navigation rules as you want on a single step. The navigation rules will be evaluated in order until one evaluates to true. If none of the navigation rules evaluate to true, the user will be sent to the next step.
You are not restricted to a single conditional when editing a navigation rule. By clicking the “AND”, “OR” and “NOT” buttons you can combine or negate the various conditions.
Branching Based on Regular Expressions
Since a web view step can return complex data, you can use regular expressions (regex) to control branching based on whether the answer matches a certain string.
For example, if you have a web view step that returns some location data, you could create a navigation rule that branched to an instruction step if the web view data matched a particular location.
The system will compare the regex against the entire web view step answer. You must account for the answer data before and after your desired string in your regex. For example,
.*Washington.*will match "any text, followed by Washington, followed by any other text."