Branching logic

Topics: Copying; logic; answer options

Determine whether or not to show a question based on conditions.

In this section we will tell LimeSurvey to only display the following questions if certain conditions are met.

Conditions
  1. With the Question Summary screen showing for the second (conditional) question (VI2), click on the Set conditions button on the Survey toolbar.
  2. In the Previous questions tab of the Question text box, click on the question that this question is conditional upon – VI1.
  3. Choose the appropriate Comparison operatorGreater than or equal to
  4. Click the Constant tab in the Answer text box, then type 1.
  5. Click the Add Condition button.
  6. Click the Close button in the top right-hand corner to close the Conditions designer window.
  7. Click Preview question group to preview the question, testing entering a 0, then another number.
  8. Close the Preview tab.

Copy questions

Copy questions
  1. Click on Question explorer in the Survey explorer panel on the left of the screen.
  2. Click on the VI1 question to select it.
  3. Click the Copy button on the Survey toolbar.
  4. In the Code: text box, type a new code – MI1 (Moderate Intensity 1 – refer to the survey design).
  5. In the Question: text box, change “vigorous” intensity sports to “moderate” intensity sports. (two places)
  6. In the Help: text box, delete the existing text then type (or copy and Paste as Plain Text):

Moderate-intensity sports include brisk walking, cycling or swimming; are likely to cause small increases in breathing or heart rate, and should be done for at least 10 minutes continuously.

  1. No Copy options are required for this question - click the Save and close button on the toolbar.
  2. Now click on the VI2 question in Question explorer to select it.
  3. Click the Copy button on the Survey toolbar.
  4. Type a new code – MI2.
  5. In the Question: text box, change “vigorous” intensity sports to “moderate” intensity sports.
  6. Click the Save and close button on the toolbar.
  7. With the Question Summary screen showing for MI2, click on the Set conditions button on the Survey toolbar.
  8. In the Previous questions tab of the Question text box, click on the question that this question is conditional upon – MI1.
  9. Choose the appropriate Comparison operatorGreater than or equal to
  10. Click the Constant tab in the Answer text box, then type 1.
  11. Click the Add Condition button.
  12. Click the Close button in the top right-hand corner to close the Conditions designer window.

Answer options

Create a new question
  1. Click the Add new Question to Group button.
  2. Code: SR
  3. Question: Type (or copy and Paste as Plain Text):

The following question is about sitting or reclining including time spent sitting at a desk, sitting with friends, travelling in a car, bus, train, reading, playing cards or watching television. Do not include time spent sleeping. How much time do you usually spend sitting or reclining on a typical day?

  1. Question type: under Single choice questions choose List (dropdown).
  2. Click the Save and close button.
Create the answer options
  1. Click the Edit answer options button on the Survey toolbar.
  2. In the first answer box, add Code: SRa, then in the first text box, type Less than 1 hour.
  3. Click the Insert a new answer option after this one button (the ‘+’ sign), then repeat until all answer options are added, incrementing the codes – SR1b, SR1c, etc. – as you go.

SRb 3 hours
SRc 4-8 hours
SRd 9-12 hours
SRe More than 12 hours

  1. Click the Save and close button.
  2. Preview the question, then close the Preview tab.