Assume you want to design a survey which asks the following questions:

  • Question 1: Have you drunk any alcohol in the last 24 hours?
    • Yes
    • No
  • Question 2: (If yes) How many standard drinks did you have?

There are three ways to ask these questions, each is explained below in details.

Using Enabling/Disabling Questions

Survey Editor

  1. Add both questions to the same page of the survey. We assume the question IDs are 1 and 2, and Question #1 also has two potential answers: "Yes" and "No".
  2. Select "Yes" answer from the Survey Navigator.
  3. From the Properties panel, edit "Enable questions" property and set it to 2 (or any other ID assigned to your second question). This way, if "Yes" is selected, Question #2 will be enabled, otherwise, it will be disabled.
  4. You also have to set Question #2 to be disabled by default. For this purpose, first, select Question #2 from the Survey Navigator.
  5. From the "Properties" panel, uncheck the "Enabled?" option. This way, the question is disabled by default, unless participant answers "Yes" to the Question #1.

JSON

The following shows how you can create such survey using JSON.

{
  "version": 2,
  "triggering_logic": {
    "trigger_title": "Drinking survey",
    "type": "user_triggered"
  },
  "sub_surveys": [
    {
      "sub_survey_id": 1,
      "sub_survey_content": [
        {
          "next_page": -1,
          "questions": [
            {
              "question_id": 1,
              "question_type": "single_choice",
              "question_content": "<p>Have you drunk any alcohol in the last 24 hours?</p>",
              "answers": [
                {
                  "answer_id": 1,
                  "answer_content": "Yes",
                  "enable_question": "2",
                  ...
                },
                {
                  "answer_id": 2
                  "answer_content": "No",
                  "enable_question": "",
                  ...
                }
              ],
              ...
            },
            {
              "question_id": 2,
              "question_type": "number",
              "question_content": "<p>How many standard drinks?</p>",
              "enabled": false,
              ...
            }
          ]
        }
      ]
    }
  ]
}

This survey has two questions, ID #1 and ID #2. The second question is set to disable by default, and the first answer of Question #1 is set to enable Question #2. This way, the participant by default sees the first question as enabled, and the second question as disabled. If she answers "Yes" to the first question, the second question gets enabled as well.

Using Branching

Survey Editor

  1. Create two pages in your survey, and add each question to each of these pages. Therefore Question #1 will be in page 1 and Question #2 will be on page 2.
  2. From the Survey Navigator select "No" answer to Question #1.
  3. From the Properties panel, set "Next page ID" property to -1. This indicates if the participant selects this answer ("No"), the survey should finish without presenting the second page.

Note if there are more questions in the survey and you simply want to skip the second page, set the "Next page ID" to 3 indicating that selecting this option should move the survey to the third page.

JSON

The following JSON shows how to design such survey using branching:

{
  "triggering_logic": {
    "trigger_title": "Drinking survey",
    "type": "user_triggered"
  },
  "sub_surveys": [
    {
      "sub_survey_id": 1,
      "sub_survey_content": [
        {
          "next_page": 1,
          "questions": [
            {
              "question_id": 1,
              "question_type": "single_choice",
              "question_content": "<p>Have you drunk any alcohol in the last 24 hours?</p>",
              "answers": [
                {
                  "answer_id": 1,
                  "answer_content": "Yes",
                  "next_page": -2,
                  "enable_question": ""
                },
                {
                  "answer_id": 2,
                  "answer_content": "No",
                  "next_page": -1,
                  "enable_question": ""
                }
              ],
              ...
            }
          ],
          ...
        },
        {
          "next_page": -1,
          "questions": [
            {
              "question_id": 2,
              "question_type": "number",
              "question_content": "<p>How many standard drinks?</p>",
              ...
            }
          ],
          ...
        }
      ]
    }
  ]
}

This survey has two pages. The "next_page" attribute of the first page is set to 1 ("next_page": 1,). Hence, by default, the survey is instructed to show the first page followed by the second page. Also, in Answer #2, the "next_page" is overwritten to -1. This indicates that if the user selects "No" as the answer, the survey will finish without showing the second page.

If there was a third page, the "next_page" attribute of the Answer #2 was expected to be 2 (0-based index of the third page), therefore selecting "No" would cause the second page to be skipped and the third page to be shown.

Using Criteria

Each page can have criteria, which if specified, will be evaluated by Ethica prior to displaying the page, and the page will be displayed only if the evaluation result is True.

Survey Editor

  1. Create two pages in your survey, and add each question to each of these pages. Therefore Question #1 will be on page 1 and Question #2 will be on page 2.
  2. Select Page 2 from the Survey Navigator.
  3. From the Properties panel, set the "Criteria" property to "Q1 == 1". This indicates that the page should be shown only if the value chosen for Question #1 is 1 (the ID of the "Yes" answer).

In this case, the participant is presented with Question #1. When she presses Next, Ethica will evaluate the response to Question 1. If the response is "Yes" (Answer ID 1), it will present the second page. Otherwise, it will skip the second page and moves to the next page (in this case finishes the survey).

JSON

{
  "triggering_logic": {
    "trigger_title": "Drinking Survey",
    "type": "user_triggered"
  },
  "sub_surveys": [
    {
      "criteria": "",
      "sub_survey_id": 1,
      "sub_survey_content": [
        {
          "next_page": 1,
          "questions": [
            {
              "question_id": 1,
              "question_type": "single_choice",
              "persisted": true,
              "question_content": "<p>Have you drunk any alcohol in the last 24 hours?</p>",
              "answers": [
                {
                  "answer_id": 1,
                  "answer_content": "Yes",
                  ...
                },
                {
                  "answer_id": 2,
                  "answer_content": "No",
                  ...
                }
              ],
              ...
            }
          ],
          "criteria": ""
        },
        {
          "next_page": -1,
          "criteria": "Q1 == 1",
          "questions": [
            {
              "question_id": 2,
              "question_type": "number",
              "question_content": "<p>How many standard drinks?</p>",
              ...
            }
          ]
        }
      ]
    }
  ]
}

This survey also has two pages, page index 0 which includes Question #1 and page index 1 which includes Question #2. Page index 1 has a criterion which specifies the page should be presented only if the response to Question #1 is "Yes" (Answer ID 1). Otherwise, this page will be skipped and the survey proceeds to the next page, or it will finish if the current page is the last page.

Note that in defining Question #1, the "persisted" attribute is set to true. This instructs Ethica to keep a copy of participant's response on the phone at all times during the study (whether 1 month, 1 year or indefinitely), so it can be used by any survey in the study for criteria evaluation. This is not necessary for this context as both the question which is used in the criteria and the criteria itself are part of the same survey sessions. But it can be helpful when a given survey is presented early in the study, and their responses is used later on for criteria evaluation.