Skip To Content

Repeats

An XLSForm can repeat a group of questions multiple times. Examples of how repeats are used include the following:

  • Capturing multiple answers to the same question in one survey
  • Capturing separate, smaller collections of records, such as the name, age, and gender of every person in a household
  • Capturing multiple images or geopoints in a single survey
A repeat to provide multiple responses to a single question

Use repeats

To repeat a group of questions in Survey123 to capture multiple responses, complete the following steps on the survey tab of your spreadsheet:

  1. In the row where you want to begin your repeat, type begin repeat in the type column.

  2. Provide a name for the repeat in the name column.

  3. In the following rows, enter the questions you want to include in your repeat.

  4. Immediately after the questions, type end repeat in the type column.

This will create a group of questions in your survey that can be added repeatedly to your survey results. By default, there is no restriction on the number of times the questions can be repeated.

Restrict the number of repeat records

To restrict the number of repeats in Survey123, set a repeat count as shown in the following steps:

  1. In the row where you want to begin your repeat, type begin repeat in the type column of the survey tab.

  2. Provide a numeric value for the number of repeats in the repeat_count column.

  3. Provide a name for the repeat in the name column.

  4. In the rows below this entry, enter the questions you want to include in your repeat.

  5. In the last row, type end repeat in the type column.

Users will only be able to repeat the group of questions the number of times specified in the repeat_count column.

Repeat records and related tables

When you publish a survey that includes repeats, each repeat will be created as a table that is related to your feature service.

Aggregate functions

Starting with version 2.1 of Survey123, aggregate functions can be used to return values derived from responses across repeats. To do this, a question inside a repeat is referenced by a question outside of the repeat. For example, the following formula will count the responses to a single question across repeats:

count(${repeated_question})

The following functions can be used to aggregate responses:

  • count
  • sum
  • min
  • max

These functions only apply to the current survey response. They don't take into account other records in the feature service. It is also possible to include questions using sum and count within the repeat; however, the use of min and max is only supported outside of it. The sum function can also be used to concatenate questions that return a string.