This example will explain how to include responses (such as a participant name) from a response to a field in a repeating group, in another repeating group later in your form.
For example, in the first repeating group might register household members. Next, you might want to capture additional information like health status for a specific member. To do this the =indexed-repeat() function can be used.
1. Add a repeating group and change the field name e.g HH_members
- Add fields to your group e.g Enter household member's name (let's call it name)
- Add repeat-index() to track the iteration of the repeat (i.e the first, second, third etc. repeat in the group)
2. Add a second repeating group to your form and change the field name e.g health_group
- Add fields to your group e.g Rate member's health (change field name e.g member_health)
- To reference the member's name from the previous group of registered household members, use the indexed-repeat() function as follow: indexed-repeat($name, $HH_members, repeat-index( ))
- where $name is the field you want to reference,
- $HH_members is the previous repeating group that contains the field you wish to reference,
- repeat-index() is the iteration of the repeating group (i.e the first, second, third etc. repeat)
Select the Preview button from the toolbar to test your form and see how it will be displayed when using the mobile app or web browser.