When you enable repeats for your a group in your form, you can ask the same set of fields multiple times. By default, repeats are not enabled when adding a new group.
This article covers repeating groups:
Note: Visit this article for steps on adding new groups in your form.
Enable repeats for a group
- Click on the group you wish to repeat and open the Basics tab.
- Select the repeating option for the group.
- The repeating group indicator in the top right of the group will be highlighted to show that repeats are allowed for this group.
On the handset, repeating groups are indicated by a blue background. The repeat number is indicated at the top of the repeat block (1). The data collector can repeat the set of fields by clicking 'Add repeat' at the bottom on the group (2). If the data collector makes a mistake by adding too many repeats, they can delete a repeat by clicking the bin icon next to the repeat number (3).
Repeating group options
Add repeats one at a time
Very useful if you do not know the number of repeats needed prior to launching the form. For example, the data collector visits multiple households and capture the name and date of birth of each household member living there. The size of each household varies greatly and it is impossible to predict what the maximum number of household members in any household will be. When you enable repeat for your a group in your form, you can ask the same set of fields multiple times. By default, repeats are not enabled when adding a new group.
Choosing this option allows the data collector to add as many repeats as needed. There is no minimum or maximum limit to the number of repeats that the data collector can add.
Repeat the group based on a value
Choosing this option will allow you to set the number of repeats in the group - either using a static value or a dynamic value, based on a response/calculation in the form. There is a prescribed number of repeats. The data collector will not have the option of selecting the amount of repeats.
See examples below:
Set repeat based on a static value e.g. 5. This group will repeat 5 times.
Set repeat based on a dynamic value by referencing a field in the form e.g. $Number_of_HH_members. This group will repeat based on the response to the field 'Number_of_HH_members'.
Note: if the response to the previous field ('Number_of_HH_members) is changed/reduced, it will affect the number of repeats in the group and subsequently the data captured for fields in the group.
Set repeat based on a dynamic value determined by a calculation/expression e.g. =(today() - $Date). This group will repeat based on the expression for example, the number of days from the start date of the program to today.
Disable repeats for a group
- Click on the group you wish to disable repeats for and open the "Basics tab" of the group.
- Select the 'Do not allow repeats for the group' option.
- The repeating group indicator in the top right of the group will turn grey to show that repeats are not allowed for this group.
Referring to the current repeat number
If you want to keep track of which repeat a field is referring to, you can type =repeat-index() into the display text. When the form is displayed on the handset, this will be replaced by the number of the repeat as shown below.
Hint: To see what these fields will look like to the mobile app, make use of the 'Preview' button on the far right in your top toolbar.