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.

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

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?

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)

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