Popular Help Content
When building a form, there may be questions that should be displayed more than once to a user. For example, in a registration form, the number of children in a household may be collected along with the name and age of each child. A set of questions that are grouped together and set to repeat is referred to as a Repeat Group. 📖Learn more about Using Repeat Groups in Forms.
Repeat groups can have multiple questions with the same path (ex. /data/child_repeat/name). For this reason, special functions are required when writing logic within a repeat group.
Use Case: Lookup table, location, or instance references.
Example: is_currently_enrolled = current()/../currently_enrolled
Inside of a repeat group titled "Registration", the question "Are you currently enrolled?" is included and the users' response to this question (currently_enrolled) will be used to filter a lookup table question labelled "Facility". The lookup table question is a sibling of the parent currently_enrolled question, meaning they are both inside of the "Registration" repeat directly, and not inside of another group. The lookup table will filter "Facilities" based on whether a field on the lookup table (is_currently_enrolled) is set to 'yes'.
The current() function starts a reference to the current "Facility" question, so the "/.." step moves the reference back to the active "Registration" repeat group, and the currently_enrolled step moves the reference to the sibling question.
Note: When saving case properties, you may find that error messages are displayed when repeat group questions are included. This is due to the fact that questions inside repeat groups cannot be saved to cases.
Model Iteration inside of a Question List