QUESTIONSTAR
Logic & Tests

Loops

About loops

Loops let you ask a question or a group of questions repeatedly within the questionnaire — for example, to rate different objects using the same questions.

Example:
In a study, you want respondents to rate different fast-food restaurants on service quality. Instead of having to create the same questions for each restaurant, you build the question(s) just once. The loop then presents these question(s) automatically for every restaurant the respondent is familiar with.

Example:
On a registration form, you collect data about all the family members coming to your event. Instead of pre-emptively setting up the same questions several times in the questionnaire and using skip logic to skip the ones you don't need, you create the questions just once. The loop repeats the questions according to the previously selected number of family members.

Loops in general

You can view an example of such a survey with the loop here and copy it into your account.

The number of loops shown to the respondent can be made dependent on the following objects and factors:

Adding a loop to the questionnaire

In QUESTIONSTAR, the loop repeats questions placed on one or more consecutive pages. Before you activate a loop in your questionnaire, make sure that the questions you want to repeat are placed one after another on one or more questionnaire pages.

To activate the loop,

  1. open the page settings for the page with the questions to be repeated and
  2. click the "Start Loop & Merge" button in the settings panel on the right.
Adding a loop

This opens the dialog where you can configure the loop settings.

Adding a loop 2

In this dialog you can

  1. Set the first page of the loop and add further pages to the loop.

    By default, the first page of the loop is set to the page on which the loop was activated.

  2. Set the type or basis of the loop.

    Possible bases for the loop are
    (a) static list,
    (b) question,
    (c) hierarchical list and
    (d) semi-hierarchical list.
    The individual loop types are described below.

  3. Set up the lookup table.

    This table defines the number of loops to run through, as well as the texts that are inserted in place of placeholders in each run of the loop.

  4. Configure the advanced settings of the loop.

Editing a loop

To edit the loop settings, click the "Edit Loop & Merge" button in the settings panel on the right of the questionnaire page. Alternatively, you can simply click the loop icon in the page header.

Editing a loop

The loop's lookup table

Every loop is based on a lookup table. The rows of this table determine the number of (possible) runs of the loop. Each row corresponds to one loop run.

The entries in the various columns of the row are used to replace the placeholders in the question texts, establishing the reference to the respective loop run — so that respondents know what they should refer to when answering the question.

The "Field {{L1}}" column also defines the name of the loop run. This field can be filled with the answer options of a previous question or manually.

{{L1}} shows the name of the placeholder you should use in your questionnaire so that, in each loop run, this placeholder is replaced by the text entered in the 1st column of the lookup table.

In QUESTIONSTAR, placeholders are always enclosed in double curly braces. "L" stands for the word "Loop". "1" stands for the column number in the lookup table.

Loop lookup table

Sometimes, in addition to the loop name, further aspects should vary from loop to loop. To do this, you can add more fields to the lookup table by clicking the green plus symbol in the top right corner of the lookup table and filling them with the corresponding texts. The placeholders you need to insert these texts are numbered from left to right in ascending order.

For example, in addition to the visit frequency and service quality of fast-food restaurants, we also want to survey respondents' attitudes toward a particular dish at the restaurant.

In this case, to be able to insert the relevant dish into the question text via a placeholder, we can fill the second field of the lookup table with the names of the dishes. The placeholder for the dish is then {{L2}}.

In the example above, the loop name for the first loop is "McDonalds" and the dish to be rated is "Big Mac". The placeholders for these are {{L1}} and {{L2}}. In the questionnaire, they are replaced with "McDonalds" and "Big Mac". In the second loop, {{L1}} is replaced by "Burger King" and {{L2}} by "Whopper". And so on.

In the survey editor, the question texts look like this:

Loop survey editor

Please note:
The questionnaire pages for which the loop is activated are highlighted in blue so you can distinguish them from the remaining pages of the questionnaire. In the navigation panel on the left, the questions on these pages are likewise highlighted in blue.

In the questionnaire, the placeholders are replaced by the texts from the row of the lookup table that corresponds to the respective loop run. In the first run these are "McDonalds" and "Big Mac", in the second run they are "Burger King" and "Whopper", and so on.

Loop McDonalds
Loop Burger King

You can view an example of such a survey with the loop here and copy it into your account.

Loop based on a static list

In the case of the static list, you enter the entire lookup table yourself. In doing so, you determine both the number of loops (through the rows of the lookup table) and the placeholder texts (in the columns of the lookup table).

Unless you configure advanced settings, all the loops you have created will be run through in this case — i.e. the questions contained in the loop will be presented to your respondents as many times as there are rows in the lookup table.

Loop static list
  1. To add a row or loop run, click the "Add Loop" button.
  2. To delete an unnecessary loop, click the red bin icon to the right of the row you want to delete.
  3. To add a column, click the green button with the plus sign in the top right corner of the lookup table.
  4. To delete a column, click the red bin icon above the column to be deleted.

URLs can also be entered as fields. These could be, for example, the URLs of the images you can use in your Custom HTML/CSS/JS questions. In the screenshot above, the URLs of restaurant logos are entered in the {{L3}} field.

Loop based on a question

A loop based on a question runs through the alternatives contained in that question. Here you can specify whether the loop should run through all alternatives or only those selected by the respondent. This and other ways of organizing a loop based on a question are explained further below.

Example:
You could ask your respondents first to select the restaurants they have already visited, and then have them rate the selected restaurants in the loop.

Loop based on the question

You can view an example of a loop based on a question here and copy it into your account.

Before you create the loop based on a question, please make sure that the question the loop will be based on is on one of the questionnaire pages that comes before the page with the questions to be repeated in the loop. The base question must therefore come before the first page of the loop.

To create the loop based on a question,

  1. open the page settings for the first loop page and
  2. click the "Start Loop & Merge" button in the settings panel on the right.
Adding a loop

This opens the dialog with the loop settings:

Loop based on the question 2

In this dialog:

  1. Select "Question" as the loop basis.
  2. Select the question the loop should be based on.
  3. Choose how the alternatives should enter the loop. Depending on the type of base question, various options are available here.

    • For multiple choice questions, the loop can run through all alternatives, only the alternatives selected by the respondent, as well as displayed or hidden alternatives.
    • For single choice and dropdown questions, the number of the selected alternative can additionally determine the number of loop runs.
    • For matrix questions, the answered or unanswered statements, or the statements for which a certain minimum rating was reached or fallen below, can additionally be included in the loop. Furthermore, the alternatives selected when rating the statements can be included in the loop.
    • For text questions, the number entered by the respondent determines the number of loop runs, whereby you can limit the maximum number of runs.

The first field of the lookup table of the question-based loop is automatically filled with all alternatives of the base question. However, only those alternatives that meet the criterion defined in step 5 are run through in the loop.

Otherwise, filling the lookup table works just as with the static loop.

In addition to the alternatives taken from the base question, you can, if needed, add further static loops. These static loops are run through additionally, after the applicable alternatives have been run through.

Loop based on a numeric answer

For questions of the type "Single Choice", "Dropdown" and "Text Input", only one alternative can be selected. For this reason, these questions are not particularly well suited for carrying the selected alternatives into the loop. The loop would only run once and is therefore superfluous.

Nevertheless, questions of these types are well suited for defining the number of loops.

Example:
You ask your respondents how many children they have, and then you ask a series of questions about each child.

Loop numeric question

You can view an example of a loop based on a numeric answer here and copy it into your account.

Creating a loop based on a numeric answer is largely identical to the loop based on a question, except that the numeric value should be selected as the loop source.

To create a loop based on a numeric answer, add a loop to your questionnaire.

Loop numeric question 2

Then

  1. Select "Question" as the loop basis.
  2. Select the question the loop should be based on.
  3. Select "Numeric Value" as the loop source.
  4. If needed, fill in the fields of the lookup table.

In addition to the alternatives taken from the base question, you can, if needed, add further static loops. These static loops are run through additionally, after the applicable alternatives have been run through.

Special case: text question with numeric input

Questions of the type "Text Input" are open-ended questions by nature. Respondents can enter any values into such questions. For this reason, the maximum value of a possible number entry is not known in advance. For this reason, the number of possible loops must additionally be limited.

Example:
You collect information about the seminars your teaching staff offered in the current semester.

Loop special case text question

Please note: to be able to set up a loop based on a numeric answer to an open-ended question, the type "Number" must be set for this question.

To create a loop based on a numeric answer, add a loop to your questionnaire.

Loop special case text question 2

Then

  1. Select "Question" as the loop basis.
  2. Select the question the loop should be based on.
  3. "Numeric Value" is set automatically as the loop source.
  4. Enter the maximum number of possible loops.
  5. If needed, fill in the fields of the lookup table.

Loop based on a hierarchical list

This type of loop was developed specifically for the case of employee surveys in which employees rate their supervisors. The relationships between employee and supervisor (i.e. who is whose boss) are mapped in a table. Because this table represents the company's hierarchy, it is called a hierarchical list.

The task:
Each employee rates their immediate supervisor, then their supervisor's supervisor, and so on up to the supervisor at the highest hierarchy level.

The hierarchical list of employee-supervisor relationships serves as the basis for the loop.

Loop hierarchical list table

In this list, each employee of the company is assigned a unique ID (e.g. personnel number). Additionally, the ID of this employee's immediate supervisor is listed (e.g. the supervisor's personnel number).

In the example above, the employee Marvin Ates has personnel number 1, and his immediate supervisor's personnel number is 2. This means his supervisor is the employee with personnel number 2, i.e. Polina Debus. This employee's supervisor has personnel number 9, which is Vanessa Pietrzinski. Her supervisor is Lea Marie Kattermann with number 5, who has no supervisor because she is the company's managing director.

Accordingly, in the employee survey, the employee Marvin Ates must rate his supervisors along the hierarchical management line Polina Debus, Vanessa Pietrzinski and Lea Marie Kattermann.

You can test what this looks like in a real questionnaire here.

Note: the ID does not necessarily have to be a number and could, for example, be the combination of last name and first name or another key. What matters is that the ID is unique per employee (i.e. there may be only one employee with this ID), and that exactly this ID is used when referring to the person.

To create a loop based on the hierarchical list,

  1. Upload the hierarchical list as a contact list.

    You can download the template for the hierarchical list here as an Excel file.

  2. Add a loop to your questionnaire.
Loop hierarchical list adding 1

Then

  1. Select "Hierarchical List" as the loop basis.
  2. Select the contact list that contains your hierarchical list.
  3. Select the field of the hierarchical list in which the employees' ID is stored (in the example above this is "Personnel number").
  4. Select the reference field of the hierarchical list in which the reference to the supervisor's ID is stored (in the example above this is "Supervisor PN").

Now you can invite your respondents via the QUESTIONSTAR mailer. Each respondent receives a personalized link that identifies them in the contact list. When the respondent clicks this link, the questionnaire opens. As soon as the respondent reaches the point with the loop in the questionnaire, they begin answering questions relating to their supervisors according to the hierarchy defined in the hierarchical list.

Loop based on a semi-hierarchical list

This type of loop was also developed especially for employee surveys and is a variation of the loop based on a hierarchical list. Here the employee rates not only their supervisors along the management hierarchy, but additionally all other supervisors at the higher management levels.

The task:
Each employee rates their immediate supervisor and then all other supervisors at the higher management levels.

Loop semi-hierarchical list

The basis for the loop is the semi-hierarchical list of employee-supervisor relationships, which is structured similarly to the hierarchical list, but which, in addition to the employees' contact data, their IDs and the field with the supervisor's ID, contains a further column stating the management level of the respective employee numerically. The highest management level (managing-director level) corresponds to the number 1. The higher the number of the management level, the further down the employee sits in the company's hierarchy.

In our example, Laura Schuchard (personnel number 12) is assigned to management level 3. She begins the loop by rating her immediate supervisor Vanessa Pietrzinski with personnel number 9. She then rates all supervisors of the higher management levels 2 and 1. Since all supervisors of the 2nd management level have already been rated with Vanessa Pietrzinski, our respondent now only needs to rate the managing director (management level 1), Lea Marie Kattermann.

You can test what this might look like in a real questionnaire here.

To create a loop based on the semi-hierarchical list,

  1. Upload the hierarchical list as a contact list.

    You can download the template for the semi-hierarchical list here as an Excel file.

  2. Add a loop to your questionnaire.
Loop semi-hierarchical list adding

Then

  1. Select "Semi-Hierarchical List" as the loop basis.
  2. Select the contact list that contains your semi-hierarchical list.
  3. Select the field of the semi-hierarchical list in which the employees' ID is stored (in the example above this is "Personnel number").
  4. Select the reference field of the semi-hierarchical list in which the reference to the supervisor's ID is stored (in the example above this is "Supervisor PN").
  5. Select the hierarchy field of the semi-hierarchical list in which the management level number is stored (in the example above this is "Management level").

Now you can invite your respondents using QUESTIONSTAR's integrated mailer. Each respondent receives a personalized link that identifies them in the contact list. When they click this link, the questionnaire opens. When the respondent reaches the point with the loop in the questionnaire, they begin answering questions relating to their supervisors according to the employee-supervisor relationships and management level defined in the semi-hierarchical list.

Advanced settings

The advanced settings of loops let you fine-tune the specific flow of the loop runs. You can influence the order of the loops and their number, as well as allow respondents to choose the next loop run themselves.

To show the advanced settings, click the text "Advanced Settings" at the bottom of the loop settings dialog.

Loop advanced settings 1

Order of loops

By default, the loops are run through in the order in which they are defined in the lookup table. This corresponds to the "Sequential loop order" setting.

You can have the order of the loop runs vary from respondent to respondent using the "Randomize loop order" setting.

Limiting the number of loops

You can also limit the number of loop runs shown to a respondent. This setting makes sense particularly in combination with the random order of loops, especially when the total number of possible loops is very high.

Loop number of loops

This way you ensure that a respondent's cognitive load stays relatively low while, at the same time, you obtain overall information on all the objects you want to rate.

Example:
You want to rate the service quality of 20 restaurants in your city. The probability that your respondents know all 20 restaurants is high. It is unrealistic that your respondents would have the time and inclination to answer the same questions 20 times. So you present each of your respondents with 3 randomly selected restaurants to rate. Although no single respondent has rated all restaurants, the total set of ratings provides you with insightful information about all restaurants.

Selecting the next loop and ending the loop by the respondent

In cases where there could be too many potential loop runs, it might make sense to give respondents the option to decide for themselves how many loops they run through or which objects they want to rate.

Example:
The number of supervisors to be rated in an employee survey at a large company can be considerably high. It happens that more than 30 managers stand above an employee in the company hierarchy. In such situations, it makes sense to have the employee rate their immediate supervisor and, additionally, give them the option to select other managers to rate at their own discretion.

The following explains the settings that control the respondents' experience in such cases:

If you give respondents the option to select the next loop themselves (1), they are asked a question before the start of each loop that lets them select the next object to be rated (e.g. the supervisor).

You can adjust the text of this question by clicking the "Edit question text" button (2).

Loop advanced settings 2

The labels of the alternatives presented to respondents for selection in this question need a rule. These could be, for example, fields of the lookup table or, in the case of (semi-)hierarchical lists, fields of the contact list.

You define this rule by entering into the "Composition of choice names" input field the placeholders (3) that refer either to the lookup table (e.g. {{L1}} {{L2}}) or to the contact list (e.g. {{RESPONDENT_FIRST_NAME}} {{RESPONDENT_LAST_NAME}}).

In the case of (semi-)hierarchical lists, you can select the placeholders from the contact list using the dropdown menu at the right end of the input field (4).

You can have the alternatives of the selection question that determines the next loop sorted alphabetically (5).

To allow respondents to end the loop, activate the setting of the same name (6).

You can adjust the text of the alternative that ends the loop in the text field (7).

Finally, you can force the first loop run (8). In this case, respondents are not asked a selection question before the first loop. Instead, they must run through the first loop in any case.

This makes particular sense when, using the (semi-)hierarchical list in an employee survey, you want the employee to rate their immediate supervisor in any case.

Tip:
If your survey has ended up very long because it can potentially contain a great many loops, activate the survey setting "Allow pausing and resuming completion". This allows your respondents to complete your questionnaire in several attempts, without having to start from the beginning each time.

Deleting a loop

If you no longer need the loop in your questionnaire, or if you added it by mistake, you can delete it by opening it for editing

Loop delete loop

… and then clicking the "Delete loop" button.

Loop delete loop 2