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

Questionnaire Conditional branching

From MoodleDocs
Revision as of 15:55, 7 August 2013 by Joseph Rézeau (talk | contribs)

New feature
in Moodle 3.8!

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::I bought it new
      • used::I bought it second-hand.
    • Please note that in the Possible answers field we are using the "short label" feature. You should use this feature if the full text of your Possible answers choices is fairly long.
    • 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 Radio Buttons question type
    • Question Name: optional
    • Response Required: Yes or No
    • Parent Question: car status->new
    • Please note that the list of potential Parent question choices displays the "short label" that we entered for the Possible answers in Q3, instead of the full text.
    • Question Text: How did you pay for your new car?
    • Possible answers:
      • I paid cash
      • I got a bank loan
    • Save Q4. Upon saving Child question Q4 you notice that a Page break has been automatically inserted between Parent question Q3 and its Child question Q4.
  • Create Q5 as a Radio Buttons question type
    • Question Name: optional
    • Response Required: Yes or No
    • Parent Question: car status->used
    • Question Text: Where did you buy your second-hand car?
    • Possible answers:
      • I bought it from a garage
      • I bought it directly from its previous owner
    • Save Q5. Upon saving Child question Q5 you notice that a Page break has been automatically inserted between Child question Q4 and Child question Q5 because these two question do not have the same Parent question.
  • Create Q6 as YES/NO question type.
    • Question Name: optional
    • Response Required: Yes or No
    • Parent Question: None.
      Question 6 is not dependent on any of the previous questions, and it will be displayed to the questionnaire respondent regardless of their previous answers.
    • Question Text: Do you sometimes use public transport to go to work?
    • Save Q6. Upon saving question Q6 you notice that a Page break has been automatically inserted between Child question Q5 and question Q6.

Now continue creating questions normally, until you want to use Conditional branching again.

Here is what your Manage questions section will look like after you have created those first 6 questions. 07-08-2013 17-49-53.jpg

Operations on Conditional branching questions

Move

Edit

Delete