Choice Filter in Repeat Group

Hi all! Bit of niche issue here, so bear with me please.

I have a repeat group in which enumerators can enter the name of water sources in a village. The relevant variable is source_identifier. The calculate variable safe_source_name filters for sources that are safe to access.

At a later stage, I have another repeat group, which repeats for each water source that the enumerator is accessing. Each time the group repeats, they can select which of the water sources they are accessing, see here:

All this works just fine. However, enumerators should only access each source once, so I want to avoid them accidentally selecting the same source a second time when the group repeats.

I’ve tried to use this solution from Josh: Restrict choices already selected from a repeat group - #16 by Josh but it requires the choices to be in the choices list, but that isn’t the case here since the choices are coming from repeat group text entries.

Any ideas are welcome, and thanks for taking the time!

Welcome back to the community, @Alison! Maybe you could share your XLSForm with the community so that the community should better understand your issue and help you out.

Sure! I’ve reduced the tool down to the relevant rows. The row in question is highlighted in yellow.
Kobo_Water-Source-Selection_Test.xlsx (13.5 KB)

I gave it another shot, and thanks to this post by Sjlver: Recomputing calculated field in repeat group, after previous instance changed - #3 by Sjlver I found a solution! It doesn’t remove previously selected answer options, but it does prevent you from selecting them again.

Here is a simplified version of the solution:

type name label::english calculation constraint constraint_message::english
begin_repeat locations Locations
text location Enter name of location
end_repeat locations
calculate concat concat(’ ‘, join(’ ', ${selected_location}), ’ ')
begin_repeat locations_assessed Select name of location assessed
select_one ${location} selected_location Select one location not(contains(${concat},${selected_location})) This location has already been assessed
end_repeat locations_assessed

Leaving this here in case anyone else runs into this issue.