Preventing duplicate entries in a repeat loop

Hi, I am trying to collect the ID of participants within a household that have now moved house.
I have the following so far:
Q1. How many household members have moved since last contact?
Then a repeat loop with repeat_count set to be the answer to Q1 containing the question:
Q2. Please enter the ID of the household member(s) that have moved

Is it possible to prevent the same participant ID being entered more than once (ie duplicate answers to Q2)?

Welcome to the community, @saspackman! Is the household member you aim to be a finite number or an infinite number?

Hi, thanks for looking at my question!

I have not put any constraints on Q1 yet, but I will need to, so it will be a finite number if I have understood correctly.

@saspackman, maybe you could do it as outlined in the image shared below:

In the survey tab of your xlsform:

Data entry screen as seen in Enketo: when the same id is entered twice

Data entry screen as seen in Enketo: when a unique id is entered

Reference xlsform:

Restrict IDs already selected from a repeat group.xlsx (10.0 KB)

1 Like

How do we make this method work for the mobile version…It only works on Enketo.

It keep throwing error…
Xpath evaluation:type mismatch
The second parameter to be the selected() function must be in quotes(like ‘1’)

Please i need a work around to this problem

Thank you

@chiabotu, could you share with the community a screenshot of the same you are seeing? Did you try the xlsform that was shared with the community?

https://community.kobotoolbox.org/uploads/short-url/doI2BkYrmoW1Py83asMJl10kGez.xlsx

Thesame challenge was posted here…buh i wanted it to work on the mobile device. It only works for enketo.

Yes…i used the form that was shared with the community…Making it work on kobocollect is imposible…saying

Xpath evaluation:type mismatch
The second parameter to be the selected() function must be in quotes(like ‘1’)

The idea here is to prevent duplicate copy of same data in thesame project before submission.
How to make it work on kobocollect app is the issue.

Thank you

Dear @Kal_Lam ,
your method would be good but when you try to add more than 2 identification numbers and try to validate/send the form it returns an error. The same applies to your solution here: Restrict choices already selected from a repeat group - #2 by Kal_Lam
Could you take a look into this? Thanks :slight_smile: