Avoiding duplicate selection in repeat group

What is the problem? Please be detailed.
I am creating a form where i have a repeat group. Users will enter "Item" in the field. When they add another field in the group, I want them to avoid selecting same item that they selected in the first field. I would appreciate a solution for this problem
I am using xls form for this purpose.

Your question is like.
If i have 5 options(a,b,c,d,e) and i select c so next time i will see again 5 options however i am not able to select optionc c.
AM i correct?
If you share more information that will be more helpful for us.


Suppose out of following items from the dropdown list user selects -"Broom"
*** Broom**

  • Detergent
  • Brush
  • Pipe

Second field in the repeat group , same lists but if user selects "Broom" again it should show some validation error or completely restrict inputting same name in the field.

I hope that is more clear!

1 Like


As far I know, repeat group will only load the same form without any changes to fill out. You can try to find an alternative solution if you would like to restrict anything on your next form. you can create duplicate forms and load them based on logics, and on those forms, you will be able to restrict a number of options/answers to be displayed.



Please have a look at the attached example which is about avoiding duplicates answers in a repeat group.
Good luck.

repeat_groups_avoid_duplicates.xls (34 KB)


Hi Souirji,

learnt something new. I had a wrong concept.



@Souirji_Abdelghani Awesome!!! :smiley: Thank you very much for the solution! This was exactly what i was looking for!

1 Like

Thanks for this. The form is running perfectly but when you download the data, the database is empty. I dont know what could be the reason? I have tried a similar looped indexed types of questions but i am loosing data for the repeat groups.

1 Like

@Levie_Nkhoma, what server/platform (and version) are you using to gather the data?

Can anyone help me with this error?
I would like to avoid duplicate selection in the items list (row 15, survey sheet in attached xls) and tried as mentioned in repeat_groups_avoid_duplicates xls file by @Souirji_Avdelghani. But it didn't work and replied as invalid in constraint expression when the attached xls was deployed into kobo toolbox.
Could you please check in the attached xls form and help me with the correct expression in constraint for avoiding of duplicate selection to the items.
Thanks in advance.Kobo_Covid19 Response_test.xlsx (20.8 KB)

@mhl, You have a mistake in form name that used in your constraint, replace white space with underscore and it works.


Hi @A.N.M_AL-IMRAN, @Souirji_Abdelghani

Please have a look at the attached example, which is based on the case above of the letters A, B, C, D.

I used substring-after() to compare the duplicate values ​​with the selected answer in ODK.

I hope this file is useful.

avoiding_duplicate_selection_in_repeat_group.xlsx (12.6 KB)

Hi, I tried to use this same example, without making any modification and is not working. Do you know what could be the reason?
I am looking for a similar example where 3 select groups are nested in a repeat loop. First select age groups (<18,>18), then sex (male, female), then education (primary school, high school, university, etc), and finally an integer to account for the number of individuals having these characteristics. Any help is more than welcome!