Skip to main content

Flow Control

In Avicenna, a Survey consists of one or more sections that are displayed in sequence to the participants. By default, these sections are shown one after another up to the last section, at which point the Survey Activity session is completed. There are multiple ways to modify the flow of Surveys based on participants' responses, including:

  • Showing or skipping a section or question. This can be done via:
    • Showing or skipping a section or question using Criteria
    • Showing or skipping a question using the Enable Questions option
    • Changing the flow of sections through the Section and Question properties
  • Looping through a section
  • Section and Question randomization

Below we explain each of these approaches in more detail.

Showing or Skipping a Section or Question

There are three methods for organizing your Survey structure in Avicenna. The most versatile approach is Criteria which lets you display or skip questions or sections based on answers to earlier questions, either within the current Survey or from previous Surveys in the study. Although powerful, this method can be complicated and challenging to manage.

Avicenna also provides simpler options for basic showing and skipping patterns, allowing you to show or skip specific questions or alter the Survey flow. If you find these options easier than using criteria, feel free to use them instead. The next sections will discuss each method in greater detail.

Showing or Skipping a Section or Question Using Criteria

Criteria enables you to set a condition that decides when a Survey section or question should be displayed or skipped. When a Criteria is applied to a section or question, Avicenna checks the condition right before showing that part of the Survey. Based on the participants' answers up to that moment, the condition is assessed as either True or False. This outcome decides if the section or question should be shown. If the condition is True, Avicenna displays the section or question, while if it's False, Avicenna moves on to the next section or the subsequent question.

info

If the section or the question with the criteria is the last, and the criteria are evaluated as False, Avicenna will finish the Survey.

Now, we are going to demonstrate how you can define a Criteria for sections. We are using the questions below in our Survey:

Section ID: 1

(QID-1 - Multiple Answer): Have you been told by a doctor that you have any of the following?
A ID: 1: Depression
A ID: 2: Generalized anxiety disorder
A ID: 3: Social phobia
A ID: 4: Agoraphobia
A ID: 5: Post-traumatic stress disorder
A ID: 6: Panic disorder
A ID: 7: Obsessive-compulsive disorder

Section ID: 2 (Questions related to the "Obsessive-compulsive disorder")

(QID-2 - Information): The following statements refer to experiences that many people have in their everyday lives. Please CIRCLE the number that best describes HOW MUCH that experience has DISTRESSED or BOTHERED YOU DURING THE PAST MONTH:

(QID-3 - Single Answer): Unpleasant thoughts come into my mind against my will, and I cannot get rid of them.
A ID: 1: Not at all
A ID: 2: A little
A ID: 3: Moderately
A ID: 4: A lot

(QID-4 - Single Answer): I think contact with bodily secretions (sweat, saliva, blood, urine, etc.) may contaminate my clothes or somehow harm me.
A ID: 1: Not at all
A ID: 2: A little
A ID: 3: Moderately
A ID: 4: A lot

In this example, we want to have Section 2 prompted only to those participants who choose Answer ID 7: Obsessive-compulsive disorder to Question 1. First, make sure that the second section is selected, and then go to Section Properties. Then find the Criteria box, and write Q17139_1 == 7. Note that 17139 refers to the ID of the current Survey, 1 refers to Question 1 in this Survey, and 7 represents the answer ID 7 ("Obsessive-compulsive disorder").

Using Criteria to Change the Sections Flow

Based on this, Section 2 will be prompted to the participants as long as they choose Answer ID 7 in the first question.

Criteria can also be used to skip or show a question. We are using the following questions as an example to demonstrate this.

(QID-1 - Single Answer): Have you ever used a set of questionnaires to check your child's motor skills?
A ID: 1: Yes
A ID: 2: No

(QID-2 - Multiple Answer): Which of the following questionnaires have you used to check your child's motor skills??
A ID: 1: The Early Motor Questionnaire (EMQ)
A ID: 2: ASQ - Ages and Stages
A ID: 3: The Child Evaluation Checklist

In this example, we want Question 2 to be available for the participants who have chosen Yes as the answer to Question 1. So, after selecting Question 2, open Question Properties, and then write Q17855_1 == 1 in the Criteria box. Remember that 17855 is the ID of the current Survey, the first 1 refers to Question ID 1, and the second 1 refers to the answer ID 1 (Yes) in Question 1.

Using Criteria to Change the Questions Flow

Showing or skipping a Question using the Enable Questions Option

Avicenna allows you to show or hide the questions within a given section based on the response provided for another question. Any potential answer for a Single or Multiple Answer question has a property called Enable Questions, which receives a list of question IDs to be enabled if the participant selects this answer.

info

Note that all the questions being shown or skipped using the Enable Questions option are expected to be in the same Section as the Single or Multiple Answer question, which contains the potential answer.

For example, assume that you want to know if participants have experienced coughing recently and, if yes, whether this was due to low air quality. You can create a Survey as follows:

(QID-1 - Single Answer): Did you experience coughing or wheezing last week?
A ID: 1: Yes
A ID: 2: No

(QID-2 - Single Answer): Do you believe that it is likely that these symptoms were related to poor air quality?
A ID: 1: Yes
A ID: 2: No

You want Question 2 to be shown only if the participants select Yes as their answer to Question 1. To do this, after selecting Question 2, open Properties from the right-side panel. Go to Question Properties, scroll down, and turn the Enabled toggle off. This instructs Avicenna to skip the question by default.

Disabling questions from Question Properties

Then, go back to Question 1. Open the Properties tab, and select Answer from Question Properties. Next, go to the Answer ID 1 section, where you should choose 2 in the Enable Questions box.

Enabling questions from Question Properties

By doing this, Avicenna will show Question 2 to the participants only if they have already responded Yes to Question 1.

Changing the Flow of Sections through the Section and Question Properties

Each section specifies what section should be shown next or whether the Survey should be marked as completed after the section is done. By default, each section points to its next section or finishes the Survey if it is the last section. You can change this flow using the Next Section ID property of each section. For example, assume that you are working on a Survey with the following sections and questions:

Section ID: 1

(QID-1 - Single Answer): Do you receive treatment for heart disease (For example, angina, heart failure, or heart attack)?
A ID: 1: Yes
A ID: 2: No

(QID-2 - Single Answer): Does your heart disease limit your activities?
A ID: 1: Yes
A ID: 2: No

Section ID: 2

(QID-3 - Single Answer): Do you receive treatment for high blood pressure?
A ID: 1: Yes
A ID: 2: No

Section ID: 3

(QID-4 - Single Answer): Do you have regular physical activity?
A ID: 1: Yes
A ID: 2: No

The default behavior is that the participant is first presented with all questions of section 1, followed by section 2 and section 3. However, this default flow of sections can be modified by using the Next Section ID in Section Properties.

For example, assume that you want to show section 3 after completing section 1 and skip presenting section 2 to the participants. To do this, first, you need to make sure that the intended section (Section 1 in our example) is selected. The selected item is shown with a blue border. Then, open Properties from the right-side panel and select 3 for Next Section ID. By doing this, Avicenna will take participants to Section 3 after completing Section 1.

Changing the next section from Section Properties

It is also possible to override the flow of the upcoming sections from Question Properties. For example, assuming we want to ask questions about blood pressure only if the person reports not having prior heart disease. To do this, choose Question 1 (from the example above) and open Properties from the right-side panel. After that, select Answer, go to Answer ID 1 ("Yes"), and choose Section ID: 3 for Next Section ID.

Changing the next section from Question Properties

By doing this, if Yes is selected in Question 1, i.e., the participant reports having heart disease, Section 2 will be skipped, and Avicenna will take the participants to Section 3. Please note that in this case, all remaining questions of Section 1 will still be asked. So the participant still will see Question 2 (“Does your heart disease limit your activities?”), no matter what they reply to Question 1.

caution

Any potential answer to a Single or Multiple Answer question can define the index of the section, which should be shown following the current section. If each answer in a Multiple Answer question defines different indexes for the next section, the last answer selected by the participant will override the previous value for the next section.

This leads to nondeterministic behavior, which is not suggested. If answers are expected to change the index of the next section in a Multiple Answer question, you need to make sure that they all point to the same section.

Looping Through a Section

You can configure a given section to be a Loop Section. In this case, Avicenna will iterate through the loop section X times, where X is based on the response to the Source Question. For example, consider the following Survey:

Section ID: 1

(QID-1 - Single Answer): Have you eaten any processed food since last week?
A ID: 1: Yes
A ID: 2: No

(QID-2 - Number): How many processed foods have you consumed?

Section ID: 2

(QID-3 - Text): What is the name of the food?
(QID-4 - Image): Take a picture of the food.

Here, in section 2, you want to ask the participant to report details of each fast food they have consumed. So you can set section 2 as a loop section and configure it to be looped based on the response to question 2.

To do so, after selecting section 2, enable the Loop Through this Section under the Properties. Then, choose Question ID 2 as the Source Question ID.

Looping a section from Section Properties

In this case, Avicenna will ask the questions in section 2 as many times as the number of times that the participant has eaten processed food in the past week.

Note that the Source Question can be either a Number or a Multiple Answer question. If you choose a Number question, the loop section will be looped X times, where X is the response to the Number question. If you choose a Multiple Answer question, the loop section will be looped once for each chosen option.

info

If the reply to the Number Source Question is 0, or no option is chosen in a Multiple Answer Source Question, the loop section will be skipped.

Questions inside a loop section also support specific placeholder: {{loop_value}}. This placeholder allows you to refer to the option being asked inside the loop section. In the case of Number Source Questions, {{loop_value}} will be replaced by an ordinal iteration number, i.e., 1st, 2nd, 3rd, 4th, and so on. In the case of Multiple Answer Source Questions, this placeholder will be replaced by the content of the chosen answers.

Let's continue our example above. To use this placeholder in our example, select the question and click on Edit, which takes you to the content box. While you are writing the content of the question, tap on Add Placeholder, and choose Loop Value.

Adding Loop Value as a Placeholder

Your questions should look like this:

Section ID: 2
Q ID: 3: Text: What is the name of the {{loop_value}} food?
Q ID: 4: Image: Take a picture of the {{loop_value}} food.

For example, if the participant has reported eating two processed foods, the flow of the questions will be as follows:

Section ID: 1

Q ID: 2: Number: How many processed foods have you consumed?
Answer: 2

Section ID: 2 - Iteration 1:

Q ID: 3: Text: What is the name of the 1st food?
Q ID: 4: Image: Take a picture of the 1st food.

Section ID: 2 - Iteration 2:

Q ID: 3: Text: What is the name of the 2nd food?
Q ID: 4: Image: Take a picture of the 2nd food.

Section and Question Randomization

We have previously discussed Section Randomization. Similarly, you can randomize the selection of questions within each section using Question Randomization. To randomly select a subset of questions within your section, you need to use the Included Question ID(s) and Selection Count options.

For example, assume that your Survey section has seven questions with IDs from 1 to 7. You want questions 1,2,3 and 4 to always be in the Survey. From questions 5, 6, and 7, you want only one of them to be randomly available in the section. To do so, open Section Properties and go to Question Randomization. Next, select questions 5, 6, and 7 from the Included Question ID(s), and set the Selection Count to 1. With these settings, this section of the Survey will consist of questions 1, 2, 3, 4, and one of the last three questions (5, 6, and 7).

Question randomization

You can also enable the Random Question Order option to randomize the order in which these questions are displayed. Keep in mind that these randomizations happen only once for each Survey session.