A Repeatable section is a special type of container that repeats itself within the form as many times as the mobile user instructs it to. The repeatable can contain various tools, inputs, etc., allowing the user to collect multiple sets of the same information, all in one form. For example, suppose you wanted to use a form to capture contact information for people that attend your event. Since you don't know how many people will show up at the door, you can use a repeatable to capture the information, one attendee at a time.
The animated image below shows a form containing such a repeatable. After finishing entering contact information for the first attendee, the user taps the button that tells them to add another attendee, which creates a new repeatable section for the second attendee:
The maximum number of repeats can be specified when building the form, or it can be specified by the mobile user when filling out a form (in a prior question). The user will be prompted at the end of each repeat with a predefined repeat action button. If the user clicks on the button another set of questions is presented.
You can nest repeatable sections. As an example if you were sent to a building complex to inspect fire extinguishers on each floor of every building you would have 3 repeatable sections. The first would allow you to select the building and enter information on the building such as the house number. The second would allow you to select floors within that building and the third would allow you to document each fire extinguisher found on a particular floor in a particular building.
Max repeats: The maximum number of times that the form user can tap the repeat button and create a new repeatable section on the form (i.e., a loop). This number must be between 1 and 20 (default value is 10). Note that mobile users will be prompted to tap a button before each loop if they wish to continue, therefore the actual number of loops is determined by the mobile user.
Variable repeats: This allows you to dynamically set the number of repeatable loops (up to the Max repeats) in your form. For example, suppose you need a number of loops equal to the number of smoke detectors in a home. You could include in your form a Numeric tool named "Number of smoke detectors," and set this field as the value source for the variable repeats. Note the following:
You must place the source tool above the Repeatable tool in the form builder.
If you choose this setting, then its value must be less than or equal to the Max repeats value. For example, if the Max repeats value is 5, and the mobile user enters a Numeric value as the Variable repeats, then the Numeric value must be less than or equal to 5 (the form user would see an error message if the value is greater than 5).
Our example setting is shown below:
- Clear repeats when variable changes: When the field that controls the number of repeats is changed, the repeats will be cleared.
Display repeat count: If Variable repeats is selected, this property determines whether a simple number will appear in parentheses following the repeatable label, like this: Section (1), or a simple number with repeat count will appear, like this: Section (1/5).
Note: A Repeatable with a large number of repeats or multiple layout containers inside it may cause performance issues.
Replace repeatable header: This setting when turned on allows users to replace the header of the repeat with a field value. By default the repeatable will show the caption text with a number to specify which repeat is which but this setting allows the header to change for each repeat. This option is very useful when users will collapse their repeatable sections. By replacing the default header your section will be clearly defined. You can use a calculation to string together multiple fields in your repeat section to provide even more clarity.
Automatically collapse repeat: This setting when turned on will automatically collapse the previous repeat when a new repeat is added. Without this setting every repeat will be opened for the user to see all the questions.