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.

1 Like

Exactly!!
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!

Hi,

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.

Thanks,
Imran

Hi@Susan_Paudel,

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)

8 Likes

Hi Souirji,

learnt something new. I had a wrong concept.

Thanks,
Imran

2 Likes

@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.

@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.

2 Likes