# Remove/Hide Selected option during a (next) repeat group

**URL:** <https://forum.getodk.org/t/remove-hide-selected-option-during-a-next-repeat-group/3600>\
**Category:** Support\
**Created:** [September 6, 2014, 9:22pm UTC](https://forum.getodk.org/t/remove-hide-selected-option-during-a-next-repeat-group/3600 "2014-09-06T21:22:06Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ayub](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ayub/32/17023_2.png) [@Ayub](https://forum.getodk.org/u/Ayub)\
**Post date:** [September 6, 2014, 9:22pm UTC](https://forum.getodk.org/t/remove-hide-selected-option-during-a-next-repeat-group/3600/1 "2014-09-06T21:22:06Z")

</div>

Hi Everyone,

I am trying to hide/remove a selected house hold member from list of  
options (from indexed-repeat), to prevent showing it during the next  
repeat. The issue i ran into is that the form works fine visually _but the  
data is missing from the fields. (see attached XML)._

_Short Version (what i did to prevent it showing up in next repeat):_

\<itemset nodeset="instance('nam')/root/item[(filtre !=  
/Multiple\_selections\_Test/option/sqMem1) and (filtre !=  
/Multiple\_selections\_Test/option/sqMem2) .... Upto All possible 10 Members \>

This results in absolutely no data in selected member  
and sqMem1, sqMem2, sqMem3 .... sqMem10 fields which are based on  
calculation of the earlier select field. But works just as required .

Any help with this form or an example would be really appreciated.

Regards,  
Ayub

[selections.xml](https://getodk.b-cdn.net/uploads/default/original/1X/ae422e9e3c1e5ff0ce0047a8a9073e292f722c90.xml) (14.7 KB)

---

<div class="post-metadata">

**Author:** ![Ayub](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ayub/32/17023_2.png) [@Ayub](https://forum.getodk.org/u/Ayub)\
**Post date:** [September 9, 2014, 9:57am UTC](https://forum.getodk.org/t/remove-hide-selected-option-during-a-next-repeat-group/3600/2 "2014-09-09T09:57:46Z")

</div>

Hi Everyone,

Given no replies in fair time, makes me highly doubtful about whether such  
behavior would be possible. It would be really appreciated if any senior  
members ( Yaw, Chris, Mitch ... or else ) add something to it.

Thanks,

Regards,  
Ayub

---

<div class="post-metadata">

**Author:** ![yanokwa](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/yanokwa/32/1695_2.png) [@yanokwa](https://forum.getodk.org/u/yanokwa)\
**Post date:** [September 9, 2014, 11:36pm UTC](https://forum.getodk.org/t/remove-hide-selected-option-during-a-next-repeat-group/3600/3 "2014-09-09T23:36:09Z")

</div>

Ayub,

Silence doesn't mean it's impossible. It usually means that the answer  
isn't obvious at first glance and no one has time to dig into it.

Yaw

> **···**
>
> -- Need ODK services? http://nafundi.com provides form design, server setup, professional support, and software development for ODK.
> 
> On Tue, Sep 9, 2014 at 2:57 AM, Ayub [nrspaggregate@gmail.com](mailto:nrspaggregate@gmail.com) wrote:
> 
> > Hi Everyone,
> > 
> > Given no replies in fair time, makes me highly doubtful about whether such  
> > behavior would be possible. It would be really appreciated if any senior  
> > members ( Yaw, Chris, Mitch ... or else ) add something to it.
> > 
> > Thanks,
> > 
> > Regards,  
> > Ayub
> > 
> > ## --
> > 
> > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > 
> > * * *
> > 
> > You received this message because you are subscribed to the Google Groups  
> > "ODK Community" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ayub](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ayub/32/17023_2.png) [@Ayub](https://forum.getodk.org/u/Ayub)\
**Post date:** [September 11, 2014, 7:23pm UTC](https://forum.getodk.org/t/remove-hide-selected-option-during-a-next-repeat-group/3600/4 "2014-09-11T19:23:37Z")

</div>

I am on it and will update if I found a working solution.

Thanks,

Ayub

---

<div class="post-metadata">

**Author:** ![Ayub](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ayub/32/17023_2.png) [@Ayub](https://forum.getodk.org/u/Ayub)\
**Post date:** [September 15, 2014, 5:11pm UTC](https://forum.getodk.org/t/remove-hide-selected-option-during-a-next-repeat-group/3600/5 "2014-09-15T17:11:53Z")

</div>

Yaw,

It would be great if you or any other member could attach an example form  
that demonstrates this functionality (probably from old archives). So far I  
couldn't find a working solution for preventing already selected members  
showing up again in group.

Best,  
Ayub

---

<div class="post-metadata">

**Author:** ![yanokwa](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/yanokwa/32/1695_2.png) [@yanokwa](https://forum.getodk.org/u/yanokwa)\
**Post date:** [September 15, 2014, 5:17pm UTC](https://forum.getodk.org/t/remove-hide-selected-option-during-a-next-repeat-group/3600/6 "2014-09-15T17:17:23Z")

</div>

Ayub,

Unfortunately, I'm out of ideas (and available cycles).  
Hopefully others can chip in.

Yaw

> **···**
>
> -- Need ODK services? http://nafundi.com provides form design, server setup, professional support, and software development for ODK.
> 
> On Mon, Sep 15, 2014 at 10:11 AM, Ayub [nrspaggregate@gmail.com](mailto:nrspaggregate@gmail.com) wrote:
> 
> > Yaw,
> > 
> > It would be great if you or any other member could attach an example form  
> > that demonstrates this functionality (probably from old archives). So far I  
> > couldn't find a working solution for preventing already selected members  
> > showing up again in group.
> > 
> > Best,  
> > Ayub
> > 
> > ## --
> > 
> > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > 
> > * * *
> > 
> > You received this message because you are subscribed to the Google Groups  
> > "ODK Community" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Mitch\_S](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/m/3ec8ea/32.png) [@Mitch\_S](https://forum.getodk.org/u/Mitch_S)\
**Post date:** [September 15, 2014, 6:07pm UTC](https://forum.getodk.org/t/remove-hide-selected-option-during-a-next-repeat-group/3600/7 "2014-09-15T18:07:56Z")

</div>

This type of form is probably not valid.

I.e., you are referencing field values that get changed by the values  
within a repeat group to affect the values shown within that same repeat  
group.

I hadn't actually thought that you could even do that. This should  
definitely not be relied upon to continue to work in future releases.

I believe the problem you are encountering is that at the very end of the  
form, when it is Marked as Finalized, the entire set of data is re-scanned  
and re-validated. During that last scan, the field values from the last  
pass through the form (after all the repeats) are used as the  
starting-point for this last validation check. And at that point, the  
fields have all be cleared or excluded from the list of choices.

I think you need to enforce a fixed order on the memberQuestions repeat so  
that these questions are asked in the exact same order in which those  
members were identified in the original repeat.

> **···**
>
> On Mon, Sep 15, 2014 at 10:17 AM, Yaw Anokwa wrote:
> 
> > Ayub,
> > 
> > Unfortunately, I'm out of ideas (and available cycles).  
> > Hopefully others can chip in.
> > 
> > ## Yaw
> > 
> > Need ODK services? [http://nafundi.com](http://nafundi.com) provides form design, server  
> > setup, professional support, and software development for ODK.
> > 
> > On Mon, Sep 15, 2014 at 10:11 AM, Ayub [nrspaggregate@gmail.com](mailto:nrspaggregate@gmail.com) wrote:
> > 
> > > Yaw,
> > > 
> > > It would be great if you or any other member could attach an example form  
> > > that demonstrates this functionality (probably from old archives). So  
> > > far I  
> > > couldn't find a working solution for preventing already selected members  
> > > showing up again in group.
> > > 
> > > Best,  
> > > Ayub
> > > 
> > > ## --
> > > 
> > > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > > 
> > > * * *
> > > 
> > > You received this message because you are subscribed to the Google Groups  
> > > "ODK Community" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send an  
> > > email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > ## --
> > 
> > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > 
> > * * *
> > 
> > You received this message because you are subscribed to the Google Groups  
> > "ODK Community" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Mitch Sundt  
> Software Engineer  
> University of Washington  
> [mitchellsundt@gmail.com](mailto:mitchellsundt@gmail.com)

---

<div class="post-metadata">

**Author:** ![Ayub](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ayub/32/17023_2.png) [@Ayub](https://forum.getodk.org/u/Ayub)\
**Post date:** [September 15, 2014, 7:15pm UTC](https://forum.getodk.org/t/remove-hide-selected-option-during-a-next-repeat-group/3600/8 "2014-09-15T19:15:15Z")

</div>

> Mitch, I tried following to force selections one by one, works great till  
> the "Mark as Finalized"
> 
> But at 'Mark as finalized form' it throws an error "sorry, this field is  
> required" and it is basically start of the 2nd repeat,
> 
> I am attaching simple version of the same form. I hope there would be some  
> work around to that.
> 
> Ayub

Edit : Had attached wrong file.

[dynamic\_list.xml](https://getodk.b-cdn.net/uploads/default/original/2X/8/87f1ae8a111ceffda8796846bc485341464bc32b.xml) (5.62 KB)

---

<div class="post-metadata">

**Author:** ![Mitch\_S](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/m/3ec8ea/32.png) [@Mitch\_S](https://forum.getodk.org/u/Mitch_S)\
**Post date:** [September 17, 2014, 6:45pm UTC](https://forum.getodk.org/t/remove-hide-selected-option-during-a-next-repeat-group/3600/9 "2014-09-17T18:45:43Z")

</div>

... haven't tested this, but the problem is the use of count(). This would  
not work if, for example, you filled out 3 repeats, then used the hierarchy  
view to go back and update the 1st one.

```
      <itemset nodeset="instance('nam')/root/item[(filtre =

```

count(/data/PeopleQuestion/perName))]"\>

use this:

```
      <itemset nodeset="instance('nam')/root/item[(filtre =

```

position(current()/..))]"\>

The expression current()/.. needs to refer to the repeat group. i.e., if  
you nest questions within begin group ... .end group, you might need to add  
an additional /.. to this to get back up to the repeat group.

> **···**
>
> On Mon, Sep 15, 2014 at 12:15 PM, Ayub wrote:
> 
> > Mitch, I tried following to force selections one by one, works great till
> > 
> > > the "Mark as Finalized"
> > > 
> > > But at 'Mark as finalized form' it throws an error "sorry, this field is  
> > > required" and it is basically start of the 2nd repeat,
> > > 
> > > I am attaching simple version of the same form. I hope there would be  
> > > some work around to that.
> > > 
> > > Ayub
> > 
> > Edit : Had attached wrong file.
> > 
> > ## --
> > 
> > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > 
> > * * *
> > 
> > You received this message because you are subscribed to the Google Groups  
> > "ODK Community" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Mitch Sundt  
> Software Engineer  
> University of Washington  
> [mitchellsundt@gmail.com](mailto:mitchellsundt@gmail.com)

---

<div class="post-metadata">

**Author:** ![Ayub](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ayub/32/17023_2.png) [@Ayub](https://forum.getodk.org/u/Ayub)\
**Post date:** [September 21, 2014, 9:24am UTC](https://forum.getodk.org/t/remove-hide-selected-option-during-a-next-repeat-group/3600/10 "2014-09-21T09:24:57Z")

</div>

Hi Mitch,

With:

I am only able to refer to the first person (5 times which is jr:count):

If I use additional /...

This gives out validate errors.

Is there a way I can refer current position of a \*specific \*nodeset for  
repeat? i.e. instead of using position(current()/..) , give complete path  
of the nodeset.

Thanks,

Ayub

---

<div class="post-metadata">

**Author:** ![Ayub](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ayub/32/17023_2.png) [@Ayub](https://forum.getodk.org/u/Ayub)\
**Post date:** [September 26, 2014, 6:29am UTC](https://forum.getodk.org/t/remove-hide-selected-option-during-a-next-repeat-group/3600/11 "2014-09-26T06:29:12Z")

</div>

Hi Mitch,

It seems like:

position(current()/..)

Is just stuck to 1, hence showing first member over and over again. Any  
ideas on how to make it work?

Best,

Ayub

---

<div class="post-metadata">

**Author:** ![Mitch\_S](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/m/3ec8ea/32.png) [@Mitch\_S](https://forum.getodk.org/u/Mitch_S)\
**Post date:** [October 2, 2014, 12:35am UTC](https://forum.getodk.org/t/remove-hide-selected-option-during-a-next-repeat-group/3600/12 "2014-10-02T00:35:19Z")

</div>

It appears that the itemset filter is being evaluated in the context of the  
group that encloses the field, rather than in the context of the field  
itself (which is what I would expect). This is likely a bug in ODK Collect.

```
      <itemset nodeset="instance('nam')/root/item[filtre =

```

position(current()/.)]"\>

I opened this issue  
[http://code.google.com/p/opendatakit/issues/detail?id=1070](http://code.google.com/p/opendatakit/issues/detail?id=1070)

Attached is a working form using the above itemset expression.

[dynamic\_list.xml](https://getodk.b-cdn.net/uploads/default/original/2X/0/0be661d66c04632743f6b05db06854b53cdf5e55.xml) (5.88 KB)

> **···**
>
> On Thu, Sep 25, 2014 at 11:29 PM, Ayub wrote:
> 
> > Hi Mitch,
> > 
> > It seems like:
> > 
> > position(current()/..)
> > 
> > Is just stuck to 1, hence showing first member over and over again. Any  
> > ideas on how to make it work?
> > 
> > Best,
> > 
> > Ayub
> > 
> > ## --
> > 
> > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > 
> > * * *
> > 
> > You received this message because you are subscribed to the Google Groups  
> > "ODK Community" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Mitch Sundt  
> Software Engineer  
> University of Washington  
> [mitchellsundt@gmail.com](mailto:mitchellsundt@gmail.com)

---

<div class="post-metadata">

**Author:** ![Ayub](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ayub/32/17023_2.png) [@Ayub](https://forum.getodk.org/u/Ayub)\
**Post date:** [October 2, 2014, 6:06am UTC](https://forum.getodk.org/t/remove-hide-selected-option-during-a-next-repeat-group/3600/13 "2014-10-02T06:06:09Z")

</div>

Hi Mitch,

Attached form works just as intended (just needed to remove the comment on  
line 161).

Thanks for your help and filing the issue, hope it gets resolved soon.

---

<div class="post-metadata">

**Author:** ![Stuart](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/stuart/32/21483_2.png) [@Stuart](https://forum.getodk.org/u/Stuart)\
**Post date:** [January 6, 2023, 6:22pm UTC](https://forum.getodk.org/t/remove-hide-selected-option-during-a-next-repeat-group/3600/14 "2023-01-06T18:22:51Z")

</div>

Is there a way of doing this via xlsx?

---

<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 10, 2023, 11:08pm UTC](https://forum.getodk.org/t/remove-hide-selected-option-during-a-next-repeat-group/3600/15 "2023-01-10T23:08:49Z")

</div>

I believe [Avoiding duplicate selection in repeat group - #22 by LN](https://forum.getodk.org/t/avoiding-duplicate-selection-in-repeat-group/9900/22) has what you're looking for.
