I have created a form to collect data at the household (family) level. The form first captures common information about the family, and then information for each individual family member.
Since the questions for each family member are the same, I placed them inside a repeat group where the enumerator can click “Add new member” to enter details for additional members.
I added a calculated field intended to display the member number (e.g., Member 1, Member 2, etc.) for each entry in the repeat group. However, the calculated field always shows “1” for every family member instead of increasing incrementally.
How can I configure the calculation so that the member number increments correctly for each repeated entry?
Currently, I have a calculated field named fm_counter with the calculation formula position(..), but this does not work as expected.
Additionally, is it possible to display a note such as “You are currently filling in details for Family Member#x**”**, where x dynamically reflects the correct member number? If so, how can this be implemented?
Finally, is it possible to limit the repeat group based on a value entered earlier in the form? For example, if the enumerator specifies that the family has 4 members, the repeat group should only allow data entry for 4 members and prevent adding a 5th member.
Any guidance or examples would be greatly appreciated.
This is what my file looks like after adding repeat count and position. When I deploy this, I’m getting the error “TypeError: Cannot read properties of null (reading ‘dataset’)”.
The form is working perfectly fine on the validator. But not when I upload it to kobotoolbox. Any idea why?
Also, the screenshot that you shared in your first reply, shows number on the top right corner of each repeated box. Does the same number appear in the xlsx data file?
Can you post the rest of your form here - I suspect the error you are seeing is related to something else unrelated.
This is the iteration number that Enketo displays for each repeat iteration section. It is not stored directly in the final submission data itself. However, the pos calculation(s) - or fm_counter in your form - is an explicit field in the form definition and therefore this data will be included in the submission data and resulting table. eg