# Duplicate value in repeat group question

**URL:** <https://forum.getodk.org/t/duplicate-value-in-repeat-group-question/11281>\
**Category:** Support\
**Tags:** form-design\
**Created:** [January 6, 2018, 12:45pm UTC](https://forum.getodk.org/t/duplicate-value-in-repeat-group-question/11281 "2018-01-06T12:45:39Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Parveen\_Negi](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/parveen_negi/32/5915_2.png) [@Parveen\_Negi](https://forum.getodk.org/u/Parveen_Negi)\
**Post date:** [January 6, 2018, 12:45pm UTC](https://forum.getodk.org/t/duplicate-value-in-repeat-group-question/11281/1 "2018-01-06T12:45:39Z")

</div>

Hiii,

I have developed an survey app using odk , Now the issue is I have created one repeat-group question , this group have a question where i am asking for multiple response in it. Now, I want when the next time repeat comes previously taken option could not be chosen again.

example:  
Q which service do use want to use (a, b, c, d, e)  
Now if , a is selected next time a should not be selected again..)

It would be very helpful if anybody provide me support for this.

Thanks in Advance

---

<div class="post-metadata">

**Author:** ![khantaung](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/k/f07891/32.png) [@khantaung](https://forum.getodk.org/u/khantaung)\
**Post date:** [January 8, 2018, 4:12am UTC](https://forum.getodk.org/t/duplicate-value-in-repeat-group-question/11281/2 "2018-01-08T04:12:54Z")

</div>

Dear Parveen\_Negi  
I would like to share two function code but it is not perfected for your problem.I hope you will be ok. Please kindly to download attached file.  
[select\_multi\_list\_show\_on\_nextQ.xlsx](https://getodk.b-cdn.net/uploads/default/original/2X/3/3e9e8446302e452bf27139538e62e195c2df42c2.xlsx) (10.8 KB)  
[select\_multi\_notselected\_list.xlsx](https://getodk.b-cdn.net/uploads/default/original/2X/3/3a6b54d62d22d37845e300a6830e383fd21b92b7.xlsx) (10.8 KB)

---

<div class="post-metadata">

**Author:** ![LN](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ln/32/1605_2.png) [@LN](https://forum.getodk.org/u/LN)\
**Post date:** [January 9, 2018, 8:33pm UTC](https://forum.getodk.org/t/duplicate-value-in-repeat-group-question/11281/3 "2018-01-09T20:33:27Z")

</div>

Ooh, this is another super fun question! 🎉 I love these puzzle forms.

@khantaung you have the right idea but the tricky thing is considering all of the previously-selected choices no matter how many repeats there are.

Take a look at the form [here](https://docs.google.com/spreadsheets/d/1IC_egzIB63W4-VwQXNZG87BPHcYnkLBAMOpPeELacXA/edit#gid=0) for a solution that I believe should work for any number of choices and any number of repeats.

---

<div class="post-metadata">

**Author:** ![ARIF\_AZAD\_KHAN](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/arif_azad_khan/32/2921_2.png) [@ARIF\_AZAD\_KHAN](https://forum.getodk.org/u/ARIF_AZAD_KHAN)\
**Post date:** [January 10, 2018, 6:04am UTC](https://forum.getodk.org/t/duplicate-value-in-repeat-group-question/11281/4 "2018-01-10T06:04:44Z")

</div>

Attached XLS also restrict to selecting the same choice in repeat group.[restrict\_duplicate\_selection\_for\_single\_select.xlsx](https://getodk.b-cdn.net/uploads/default/original/2X/e/e8b65a13133cedc8c0f9b56429b4b0d33b9a82b1.xlsx) (10.6 KB)

@LN Thanks for sharing the XLS.But is it possible to apply the same restriction to multiple choice selection? If one item is selected then a user cannot select the same item in the next iteration.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Parveen\_Negi](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/parveen_negi/32/5915_2.png) [@Parveen\_Negi](https://forum.getodk.org/u/Parveen_Negi)\
**Post date:** [January 17, 2018, 11:48am UTC](https://forum.getodk.org/t/duplicate-value-in-repeat-group-question/11281/5 "2018-01-17T11:48:25Z")

</div>

Thanku so much khangaung for your valuable reply...

---

<div class="post-metadata">

**Author:** ![LN](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ln/32/1605_2.png) [@LN](https://forum.getodk.org/u/LN)\
**Post date:** [September 24, 2018, 10:48pm UTC](https://forum.getodk.org/t/duplicate-value-in-repeat-group-question/11281/6 "2018-09-24T22:48:20Z")

</div>

A post was merged into an existing topic: [How can I remove selected select choices after each repeat?](https://forum.getodk.org/t/how-can-i-remove-selected-select-choices-after-each-repeat/15387/2)

---

<div class="post-metadata">

**Author:** ![LN](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ln/32/1605_2.png) [@LN](https://forum.getodk.org/u/LN)\
**Post date:** [June 4, 2019, 5:07pm UTC](https://forum.getodk.org/t/duplicate-value-in-repeat-group-question/11281/7 "2019-06-04T17:07:44Z")

</div>

A post was split to a new topic: [Branching based on selection](https://forum.getodk.org/t/branching-based-on-selection/20235)

---

<div class="post-metadata">

**Author:** ![Bornok](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/bornok/32/1790_2.png) [@Bornok](https://forum.getodk.org/u/Bornok)\
**Post date:** [July 28, 2019, 2:07am UTC](https://forum.getodk.org/t/duplicate-value-in-repeat-group-question/11281/8 "2019-07-28T02:07:20Z")

</div>

Dear @LN,  
The sample form is great!, Now,I'm trying not to duplicate 1 or 2 option from a household (e.g. there could be a wife and husband only). Is it possible?

Thanks,

---

<div class="post-metadata">

**Author:** ![jd2701](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/j/f19dbf/32.png) [@jd2701](https://forum.getodk.org/u/jd2701)\
**Post date:** [May 9, 2020, 7:18am UTC](https://forum.getodk.org/t/duplicate-value-in-repeat-group-question/11281/9 "2020-05-09T07:18:40Z")

</div>

Hi, great post !  
I have the opposite problem 🙂  
In a repeat group, how can i select the same defaults value as the previous "same" question.

I want to create a form for describe the lithology.  
I have a begin\_repeat with depth and the lithology in a select\_multiple.  
When I add a new repeat group, I want select by default the same lithology than the previous group.  
I think I'm almost there :  
[XLSFORM\_litho.xlsx](https://forum.getodk.org/uploads/short-url/r62ZGTc3vyzw2FCtoVGQkM0h3Fu.xlsx) (17.0 KB)

Thank you for help

---

<div class="post-metadata">

**Author:** ![prosperous](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/prosperous/32/6334_2.png) [@prosperous](https://forum.getodk.org/u/prosperous)\
**Post date:** [May 29, 2020, 3:03pm UTC](https://forum.getodk.org/t/duplicate-value-in-repeat-group-question/11281/10 "2020-05-29T15:03:23Z")

</div>

Hi, this is great. Thanks.

---

<div class="post-metadata">

**Author:** ![rakesh\_ranjan1](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/rakesh_ranjan1/32/9665_2.png) [@rakesh\_ranjan1](https://forum.getodk.org/u/rakesh_ranjan1)\
**Post date:** [June 1, 2020, 12:17pm UTC](https://forum.getodk.org/t/duplicate-value-in-repeat-group-question/11281/11 "2020-06-01T12:17:32Z")

</div>

Dear Mr. Khan i am trying this in my Tool but not working i am attaching the file. plz help me. Repeat in Q414A [AES\_Village Tool.xls](https://forum.getodk.org/uploads/short-url/5oMhq0Hc7X5f8c7alCR8qZRpNKI.xls) (268.5 KB)

---

<div class="post-metadata">

**Author:** ![ARIF\_AZAD\_KHAN](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/arif_azad_khan/32/2921_2.png) [@ARIF\_AZAD\_KHAN](https://forum.getodk.org/u/ARIF_AZAD_KHAN)\
**Post date:** [June 2, 2020, 7:28am UTC](https://forum.getodk.org/t/duplicate-value-in-repeat-group-question/11281/12 "2020-06-02T07:28:14Z")

</div>

I believe better solution exists in the forum you just need to find out.

---

<div class="post-metadata">

**Author:** ![Hussein\_Lightwalla](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/hussein_lightwalla/32/15868_2.png) [@Hussein\_Lightwalla](https://forum.getodk.org/u/Hussein_Lightwalla)\
**Post date:** [June 25, 2021, 9:42am UTC](https://forum.getodk.org/t/duplicate-value-in-repeat-group-question/11281/13 "2021-06-25T09:42:41Z")

</div>

By the way, there's a problem with submitting data (in some instances) for this example xlsform:

1.) Select 'a', add another row  
2.) Select 'b', add another row  
3.) Select 'b' - you get an error message as expected. Select 'c' instead, the error disappears  
4.) Hit submit - you aren't able to because you get the error message on the second selection.

So there probably needs some tweaking to this validation - anyone who has worked it out yet?

---

<div class="post-metadata">

**Author:** ![cesar\_miguel\_escobed](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/cesar_miguel_escobed/32/17408_2.png) [@cesar\_miguel\_escobed](https://forum.getodk.org/u/cesar_miguel_escobed)\
**Post date:** [May 4, 2023, 9:34pm UTC](https://forum.getodk.org/t/duplicate-value-in-repeat-group-question/11281/14 "2023-05-04T21:34:22Z")

</div>

If in this example I wanted to create a question, how many ids do I want to add, would it have to be a begin repeat called more\_ids, how could I do it? join(' ', more\_ids/${rpt}[position != current()/../position]/id)

---

<div class="post-metadata">

**Author:** ![SimonMontford](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/simonmontford/32/22075_2.png) [@SimonMontford](https://forum.getodk.org/u/SimonMontford)\
**Post date:** [September 4, 2023, 9:49am UTC](https://forum.getodk.org/t/duplicate-value-in-repeat-group-question/11281/15 "2023-09-04T09:49:14Z")

</div>

count(${groupname}/itemname[text() = current()]) \< 2
