Using conditions in surveys

Creating Surveys Using Conditional Logic 
As you're designing your survey, you can apply logic features to control the behavior of your survey and enhance the quality of your data.


mWater conditions are processed dynamically, which means basing logic off of a Previous Question on the same page is allowed.  It must come before the question you are applying the logic to.

mWater conditions can also be used for sections - meaning that a section will be skipped or only shown based on the answer to a question in a previous section.


You can also view this video for a guided demonstration of using conditional logic.

Overview

Dynamically include or exclude questions
mWater conditions features allow you to customize your survey to exclude or include questions in a survey based on the replies given from the respondent in earlier questions. This is called skip logic or conditional branching. mWater lets you easily do this. 
It usually works like: do -> this if -> condition met and vice versa.

Logic Types

Conditions may be applied to any type of question:

Each type of logic behaves slightly differently in this regard, allowing for a wide range of flexibility with your conditions.

Question Logic is processed dynamically, which means basing logic off of a Previous Question on the same page is allowed.  It must come before the question you are applying the logic to.

Section Logic is processed as the next section is being loaded. A section will be skipped or shown based on the answer to a question in a previous section. 

Question Logic

Section Logic

Question Logic
Question Logic
Section Logic
Section Logic

Condition Settings

Setting up a condition
This screen is a dynamic form. Depending on the fields you've added and choices that you have set determines if -> then fields.
Choices in the drop down for if -> fields:

Question Logic

Only show a question based upon the answer to a previous question


For example, in the below survey we ask survey respondents if they treat their drinking water to make it safe. The second question in the survey asks what kind of treatment. We only want to ask "what kind of treatment?" if they answered "Yes" to the previous question.

Set up the condition

To set this up we will use question logic on the question we wish to conditionally show (a.k.a the target question).
  1. Edit the target question that you wish to conditionally show.
  2. Go to Conditions and click + add condition.
  3. Using the logic builder, set up the logic condition/s.

a. First, select a question from the current section or a previous section that will be used in the IF part of the rule. In the case of a matrix question, you will choose a specific row of the matrix to use.

b. Next, select the operator that will be used to evaluate the question. After you select your question, the system will apply the recommended operator for the question type you selected. 

c. Finally enter the value or values that are required to complete the rule.

The above pictured rule can be read as, "If 'Do you treat your drinking water to mkae it safe?' is Yes, then show the question."

Section Logic

Only show a section based on an answer in the previous section

If you created a survey using sections you can include or exclude sections based on the answers given in a previous section. For example in the below survey we require informed consent to administer the household questionnaire. If consent is not given then the follow up sections with the questionnaire are not displayed and the survey ends.

Set up the condition

How to set this is very similar to the way it is for a question logic.
  1. Edit the section you wish to conditionally show
  2. Go to Conditions and click + add a condition
  3. Using the logic builder, set up the logic condition/s.

a. First, select a question from the previous section that will be used in the IF part of the rule. In the case of a matrix question, you will choose a specific row of the matrix to use.

b. Next, select the operator that will be used to evaluate the question. After you select your question, the system will apply the recommended operator for the question type you selected. 

c. Finally enter the value or values that are required to complete the rule.

The above pictured rule can be read as, "Show only if all are true 'If consent' isn't No, then show the Section."

Advanced Conditions

Apply logic based on multiple conditions—a respondent's answers, custom data from formulas, or custom variables. When the criteria you define in your conditions are met, you can skip respondents to future points in your survey, show or hide questions, show or hide pages, or invalidate questions and customize the error message.


Update / Calculate Field


You can insert or change the value of an input type field based from the rules you have set in your conditional logic. Let's say you want to perform a calculation and pass it on a text box field named "Total" when a certain field is filled out.


Design/Manage


Once you complete the condition save and test your form. Always move respondents forward through a survey. Preview and test your skip logic to ensure that each logic path is set up correctly. Make sure that the condition is working properly before adding more conditions to your form

Best Practice Tips