Duplicate value in repeat group question

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

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 (10.8 KB)
select_multi_notselected_list.xlsx (10.8 KB)

Ooh, this is another super fun question! :tada: 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 for a solution that I believe should work for any number of choices and any number of repeats.

Note that I had to compute the choices selected so far in two steps, one outside the repeat and one inside. This is because doing join(' ', ${choice}) inside the repeat only considers the latest repetition. This is an example of the unfortunate deviation with XPath that @martijnr described at https://opendatakit.github.io/xforms-spec/#a-big-deviation-with-xforms.

5 Likes

Attached XLS also restrict to selecting the same choice in repeat group.restrict_duplicate_selection_for_single_select.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.

1 Like

Thanku so much khangaung for your valuable reply...

A post was merged into an existing topic: How can I remove selected select choices after each repeat?

A post was split to a new topic: Branching based on selection

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,

1 Like

Hi, great post !
I have the opposite problem :slight_smile:
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 (17.0 KB)

Thank you for help

Hi, this is great. Thanks.

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 (268.5 KB)

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