Validate against duplicate entries within nested repeats

Hi everyone,

I have the following scenario:

I’m collecting data for a household, and each household can have a maximum of say, 3 plots of land. And for each of these three, they can grow a maximum of 2 crop types. So I want to collect data on crop yields for each plot and it’s important to prevent a situation whereby a user enters a given crop more than once for a given plot, i.e, this is valid:

Plot A
Crop Maize

Plot A
Crop Beans

Plot B
Crop Maize

Plot B
Crop Beans

but not

Plot A
Crop Maize

Plot A
Crop Maize <— duplication

To achieve this kind of data collection I am using nested repeats of questions…can anyone advise on what kind of calculation/constraint would help me achieve the above validation? It seems as though I’d need to use loop logic to check through the values of the repeats and halt/flag on encountering a repeat but I can’t imagine how I’d do that with the XLSX form?

Thanks in advance!



I have the same issue, any advice here?

Many thanks


Hi @dianedetoeuf,

Referring to the requirements laid by @Hussein_Lightwalla1 i have made a workaround which should help solve your issue, Please follow the instructions outlined in the image below:

In the survey tab of your xlsform:

In the choices tab of your xlsform:
Image 2

Data Entry as seen in Enketo:

Assumptions: The crops within Plot A or Plot B should be different. Same entry should flag an error message

Have a great day!

1 Like

Hi @Kal_Lam,

Thank you for your detailed answer. Do you think it would be possible to do the same with a question in a repeat group?

begin repeat
plot type
plot size
end repeat

with a constraint so that the same plot type cannot be repeated?



@dianedetoeuf, you should be able to do it as outlined in the post discussed previously:


In the example given above the second crop required status should be false so as not to cause fabrication. Alt add choice None/Same.