Repeat sections
Understanding exported data - Repeat sections
If your templates use repeat section, you may want to link data between or across multiple sections.
To understand the data involving repeat sections, it's important to understand the structure and concepts of repeat sections to see how they work.
There are 3 key item types:
dynamicfield
/ Repeat section: This is the repeat section itself.primeelement
: This is the "template" for any items/questions added when adding a new repeat section. This is not visible when conducting inspections.element
: This is an instance of the prime element. This is what you see when conducting inspections.
Consider the following example of repeat sections.
This data appears as follows when exported
item_id | parent_id | type | primeelement_id | primeelement_index | label | response |
---|---|---|---|---|---|---|
aaaa | zzzz | dynamicfield | My Repeated Section | |||
bbbb | aaaa | primeelement | bbbb | |||
cccc | cccc | textsingle | cccc | My Repeated Text | ||
dddd | dddd | question | dddd | My Repeated Question | ||
eeee | aaaa | element | bbbb | 0 | ||
ffff | eeee | textsingle | cccc | 0 | My Repeated Text | Text for 1 |
gggg | eeee | question | dddd | 0 | My Repeated Question | Yes |
hhhh | aaaa | element | bbbb | 1 | ||
iiii | hhhh | textsingle | cccc | 1 | My Repeated Text | Text for 2 |
jjjj | hhhh | question | dddd | 1 | My Repeated Question | No |
kkkk | aaaa | element | bbbb | 2 | ||
llll | kkkk | textsingle | cccc | 2 | My Repeated Text | Text for 3 |
mmmm | kkkk | question | dddd | 2 | My Repeated Question | N/A |
As a tree the structure looks like this.
dynamicfield - My Repeated Section (id: aaaa)
├── primeelement (id: bbbb)
│ ├── My Repeated Text (id: cccc)
│ └── My Repeated Question (id: dddd)
├── element (id: eeee, primeelement_id: bbbb)
│ ├── My Repeated Text (id: ffff, primeelement_id: cccc)
│ └── My Repeated Question (id: gggg, primeelement_id: dddd)
├── element (id: hhhh, primeelement_id: bbbb)
│ ├── My Repeated Text (id: iiii, primeelement_id: cccc)
│ └── My Repeated Question (id: jjjj, primeelement_id: dddd)
└── element (id: kkkk, primeelement_id: bbbb)
├── My Repeated Text (id: llll, primeelement_id: cccc)
└── My Repeated Question (id: mmmm, primeelement_id: dddd)
The primeelement_id
will always be identical for the same question across different element
s/repeat sections.
primeelement_index
increments from 0
and is the index of the element
in the repeat section. Questions under the same element
will have the same index.
Updated about 1 year ago