Note: You are currently viewing documentation for Moodle 2.5. 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
Line 36: Line 36:


*Create Q1 as a Yes/No question.
*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.
**'''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 keep 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.
**'''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?''
**'''Question Text''': ''Do you own a car?''
Line 42: Line 42:


*Create Q2 as a Text Box question type
*Create Q2 as a Text Box question type
**Question Name: optional
**'''Question Name''': optional
***'''Response Required''': ''Yes'' or ''No''
**'''Response Required''': ''Yes'' or ''No'' (depending on what you want to do with that question's answers later on).
**'''Parent Question''' : ''own car->Yes''. The Parent question option offers 2 choices, since it is a Yes/No question.
**'''Parent Question''' : ''own car->Yes''. The Parent question (Q1) option offers 2 choices, since it is a Yes/No question.
**'''Question Text''': ''What is the colour of your car?''
**'''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.
**Save Q2. Upon saving Child question Q2 you 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
*Create Q3 as a Radio Buttons (or Dropdown Box) question type
**'''Question Name''': ''car status''
**'''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.
**'''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
**'''Parent Question''': own car->Yes
Question Text: Did you buy it new or second-hand?
**'''Question Text''': Did you buy it new or second-hand?
Possible answers:
**'''Possible answers''':
new
***''new''
second-hand
***''second-hand''
**Save Q3. Upon saving Child question Q3 you notice that no Page break has been inserted. This is because both Q2 and Q3 are Child questions of the same Parent question Q1 and thus will be displayed on the same page of the questionnaire.


Create Q4 as a Text Box question type
Create Q4 as a Text Box question type

Revision as of 08:31, 7 August 2013

New feature
in Moodle 2.5!

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 keep 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 (depending on what you want to do with that question's answers later on).
    • Parent Question : own car->Yes. The Parent question (Q1) 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 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
    • Save Q3. Upon saving Child question Q3 you notice that no Page break has been inserted. This is because both Q2 and Q3 are Child questions of the same Parent question Q1 and thus will be displayed on the same page of the questionnaire.

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.