[ODK2] Repeat questions


I have a form with several screens and each screen has several questions.
I would like a screen (with its questions) to be repeatable. I have found the household_member example but I didnt understand how it works …

Thanks for any tip


Can you be more clear on the question. If possible can you attached your questions.

Hello Karim,

The following page from the ODK documentation should help: https://docs.opendatakit.org/form-logic/?highlight=repeat%20group#repeating-questions-and-groups-of-questions


Joseph, I am using the version 2 of ODK, I am not sure I can use this.
For a screen, in the xls file, I have for example :
begin screen
question 1
question 2
question 3
end screen
And I want to repeat it



Dear Karim,

If you want to repeat a set of questions with ODK2 (for example, ask each household member their name and age), you will basically design two surveys, one the “main” (household) form and one the “subform” (individuals). You link them with a “query” that uses linking variable(s), for example, the household id.

The documentation for queries is here: Using ODK-X XLSX Converter — ODK-X Docs

And we did an example in these training materials:

The 10_ slide deck, part c. (solutions are online there as well).

Hope that helps!


Hello KarimHousehold_Example.xlsx (38.3 KB)

Here is the sample I had done. Hope this works for you.


Many many thanks to all !


as you mentioned, we can design household member as sub-form for each member but in that case each sub-form can not be linked and depended on each another.

For example, If mother is 25 years old and we filled one sub-form entry. For her son we will fill next sub-form but when they enter age of son as 20 there should be error saying the age difference between mother and son is 5 years which is very less. Please correct your entry.

I have customized and designed HTML page which look like following

The UI works nicely but I don’t know how to save the repeated rows in database and also when i edit the form it does not displayed as i filled.

Note: In the ODK 2 tools, we have eliminated the concept of a repeat-group. (https://docs.opendatakit.org/odk2/)

Dear @hpardess,

Although a bit complex, it is actually possible to do exactly what you are suggesting with a subform structure. When you put in the line number of the father, you can at the same time assign a variable based on the query that extracts the age of the father from his subform (you use line number of the father to look it up), and then verify it against the age of the child.

Hope that helps!


I did it in the attached file

test_v2_2kk.xlsx (22.5 KB)

I want to repeat the sectionX so I put as many sectionX as I need (2 here). Not sure it is the correct way to do that

what if you don’t know how many times it should be repeated? for example, it is house hold survey, in one section you want to collect details of all house members. House members of all families are not equal in count. so we could not predict how many times the section have to repeated.

@hpardess, @elmps2018 is correct that you could this with subforms (which were designed to replace repeats in ODK 2).

Also if you want to use your custom HTML page you are showing you can have Tables render that webpage and use odkdata to create/update database rows.

See https://docs.opendatakit.org/odk2/tables-web-pages/

Especially the injected java script interfaces documentation, specifically odkdata. https://docs.opendatakit.org/odk2/injected-interfaces/#odkdata-js

@clarice_larson post also has good advice how to do things in Survey or Tables.