Note: You are currently viewing documentation for Moodle 3.7. Up-to-date documentation for the latest stable version of Moodle may be available here: Questionnaire Conditional branching.

Questionnaire Conditional branching: Difference between revisions

From MoodleDocs
No edit summary
No edit summary
Line 1: Line 1:
{{Questionnaire}}
{{New features}}
{{New features}}
TODO: Questionnaire Conditional branching docs
==Overview==
 
===Definition===
Conditional branching (or Skip logic) is a feature that changes what question or page a respondent sees next based on how they answer the current question. Conditional branching creates a custom path through the survey that varies based on a respondent’s answers.
 
===Organization===
In the Questionnaire plugin, the Conditional branching path is organized through ''pages'', containing one or more "child" questions depending on a "parent" question.
 
===Settings===
If you want to use the Conditional branching feature in a Questionnaire, when you create or edit the questionnaire, in the Response options section of the settings, you must set the '''Allow branching questions''' option to ''Yes''. Please note that this option is set to ''No'' by default.
 
==A simple example==
 
===The flow we want to obtain===
 
*Page 1
**Question 1 Do you own a car? Yes/No.
***Answer Yes -> go to page 2
***Answer No -> go to page 5 (i.e. skip over irrelevant questions in pages 2 through 4)
*Page 2
**Question 2: What is the color of your car?
**Question 3: Did you buy it new or second-hand?
***Answer new -> go to page 3
***Answer second-hand -> go to page 4
*Page 3
**Question 4: Did you pay your new car cash or did you get a bank loan?
*Page 4
**Question 5: Did you buy your second-hand car from a garage or directly from its previous owner?
*Page 5
**Question 6: Do you sometimes use public transport to go to work?
etc.
 
===Procedure to obtain that flow===
 
*Create Q1 as a Yes/No question.
**'''Question Name''': ''own car''. Note that you ''must'' give your question a name, as this name will be used later on in the Questionnaire to build the list of available Parent questions. Please make this name as short as possible.
**'''Response Required''': ''Yes''. Since you plan to use question Q1 as a Parent question, it would not make sense to set it as non-required.
**'''Question Text''': ''Do you own a car?''
**Save Q1. No Page break will be inserted at this stage because you have not yet used a Parent question to create one or more Child questions.
 
*Create Q2 as a Text Box question type
**Question Name: optional
***'''Response Required''': ''Yes'' or ''No''
**'''Parent Question''' : ''own car->Yes''. The Parent question option offers 2 choices, since it is a Yes/No question.
**'''Question Text''': ''What is the colour of your car?''
*Save Q2. Upon saving Child question Q2 you will notice that a Page break has been automatically inserted between the Parent question Q1 and its Child question Q2.
 
*Create Q3 as a Radio buttons (or Dropdown box) question type
**'''Question Name''': ''car status''
**'''Response Required''': ''Yes''. We are giving question Q3 a name and setting it as Required because we plan to use it as a Parent question.
Parent Question : own car->Yes
Question Text: Did you buy it new or second-hand?
Possible answers:
new
second-hand
 
Create Q4 as a Text Box question type
Question Name: optional
Response Required: Yes or No
Parent Question : car status->new
Question Text: Why did you buy your car new?
 
Create Q5 as a Text Box question type
Question Name: optional
Response Required: Yes or No
Parent Question : car status->second-hand
Question Text: Why did you buy your car second-hand?
 
Question 6 (see above). Now continue creating questions normally, until you want to use Skip Logic again.

Revision as of 22:08, 5 August 2013

New feature
in Moodle 3.7!

Overview

Definition

Conditional branching (or Skip logic) is a feature that changes what question or page a respondent sees next based on how they answer the current question. Conditional branching creates a custom path through the survey that varies based on a respondent’s answers.

Organization

In the Questionnaire plugin, the Conditional branching path is organized through pages, containing one or more "child" questions depending on a "parent" question.

Settings

If you want to use the Conditional branching feature in a Questionnaire, when you create or edit the questionnaire, in the Response options section of the settings, you must set the Allow branching questions option to Yes. Please note that this option is set to No by default.

A simple example

The flow we want to obtain

  • Page 1
    • Question 1 Do you own a car? Yes/No.
      • Answer Yes -> go to page 2
      • Answer No -> go to page 5 (i.e. skip over irrelevant questions in pages 2 through 4)
  • Page 2
    • Question 2: What is the color of your car?
    • Question 3: Did you buy it new or second-hand?
      • Answer new -> go to page 3
      • Answer second-hand -> go to page 4
  • Page 3
    • Question 4: Did you pay your new car cash or did you get a bank loan?
  • Page 4
    • Question 5: Did you buy your second-hand car from a garage or directly from its previous owner?
  • Page 5
    • Question 6: Do you sometimes use public transport to go to work?

etc.

Procedure to obtain that flow

  • Create Q1 as a Yes/No question.
    • Question Name: own car. Note that you must give your question a name, as this name will be used later on in the Questionnaire to build the list of available Parent questions. Please make this name as short as possible.
    • Response Required: Yes. Since you plan to use question Q1 as a Parent question, it would not make sense to set it as non-required.
    • Question Text: Do you own a car?
    • Save Q1. No Page break will be inserted at this stage because you have not yet used a Parent question to create one or more Child questions.
  • Create Q2 as a Text Box question type
    • Question Name: optional
      • Response Required: Yes or No
    • Parent Question : own car->Yes. The Parent question option offers 2 choices, since it is a Yes/No question.
    • Question Text: What is the colour of your car?
  • Save Q2. Upon saving Child question Q2 you will notice that a Page break has been automatically inserted between the Parent question Q1 and its Child question Q2.
  • Create Q3 as a Radio buttons (or Dropdown box) question type
    • Question Name: car status
    • Response Required: Yes. We are giving question Q3 a name and setting it as Required because we plan to use it as a Parent question.

Parent Question : own car->Yes Question Text: Did you buy it new or second-hand? Possible answers: new second-hand

Create Q4 as a Text Box question type Question Name: optional Response Required: Yes or No Parent Question : car status->new Question Text: Why did you buy your car new?

Create Q5 as a Text Box question type Question Name: optional Response Required: Yes or No Parent Question : car status->second-hand Question Text: Why did you buy your car second-hand?

Question 6 (see above). Now continue creating questions normally, until you want to use Skip Logic again.