Developers may be interested in the companion ODK XForms spec proposal.
Background
Repeats make it possible to capture data about multiple things of the same kind within the context of a single form. This means capturing the item data can be embedded in a broader flow and there can be logic used to perform validation between those items.
Users want to create Entities from those repeat so that they can follow up with them. Some practical examples:
- In an agricultural context, it's common to have to capture information about many fields in the same farm. See @dast's Insiders lightning talk and showcase post.
- Household surveys often involve capturing info about individual household members associated with that household. See Form linking
Currently, a single form submission can only create or update a single Entity. We propose making it possible for a submission to either create or update a single Entity OR create/update multiple Entities in a single Entity List from a repeat.
XLSForm spec
entities sheet
:
We propose adding a repeat
column in which a reference to a repeat
can be specified. All other references used in other columns such as label
, create_if
, entity_id
, etc, would be evaluated in the context of that repeat.
For now, exactly one Entity declaration would be allowed.
list_name | repeat | label |
---|---|---|
trees | ${tree} | ${species} |
survey
sheet:
When an Entity declaration is specified on the entities
sheet, save_to
values would only be allowed in that repeat.
type | name | label | save_to |
---|---|---|---|
begin_repeat | tree | Tree | |
geopoint | location | Get tree location | geometry |
text | species | Species | species |
end_repeat |
Future work
In the future, we expect to further expand to the following:
- create/update multiple Entities in a single Entity List from a repeat AND a parent Entity in the same or a different Entity List
- create/update multiple different Entities from the top level and from multiple repeats
Please let us know if you have any feedback!