Working with Repeat groups (now Sub-forms)

I am working on a survey that has got a set of questions linked to the number of children under 5 years. Is there a way to code the set questions so that they be answered based on the number of children under 5 pre-entered without necessarily using the linked tables? For example if a user enters the number of children to be 3,then the set questions are asked 3 times.

Hi @jaredagia! As you are new to the community, when you get a chance, please introduce yourself here.

ODK-X does not have repeat groups (ODK does) but as you note there are linked tables. If you don’t want to use linked tables, you can program questions in repeatedly and then use skips, but I would really recommend using linked tables – that’s what they are designed for, to capture different levels of data (e.g. children under 5 years in your case).

You can constrain the number of responses (instances) in the linked table to be the right number of children, that’s what I usually do for surveys, although there may also be some way of creating the right number of instances too if you are more programming savvy than I am :slight_smile:

2 Likes

@elmps2018, Thank you for your suggestion. I thought there could be another way of having the questions in one sheet but it seems not,I will have to use the linked tables.

2 Likes

@elmps2018 Could you show an example (in Excel) about how to constrain the number of responses (instances) in the linked table? Thanks!

Hi @Larry_Li!

Yes, here’s an example in our main household form quest1_00_0.xlsx (457.5 KB). In the 3_0_individual_data section we ask for the number of members in the household in q300. Then there’s a linked table (quest1_03_0) where we add each individual’s roster data (name, sex, age, etc.). On line 20 of 3_0 we use a query and async_assign to count the number of roster entries in the household (q100 is the household identifier). There’s a note and then a constraint right below that to confirm and ensure that you entered the exact same number of members into the roster as you said were in the household in q300.

1 Like

@elmps2018 Many thanks!! Very helpful!

1 Like