Filtering a multi-select

Hi guys

We’ve seen some examples here of filtering cases for multi selects and similar options.

here’s where this is slightly different:

i have a repeat that collects household member information such as their name and age.

in another repeat group, i’m grouping those members based on user input. so, the form would ask “How many groups do you wish to make?” and the answer would be some numeric value.

a new repeat is started, with a multi-select referencing the household members. it’s working great.
here’s what i’m having a problem with:
in the first iteration of this repeat group, i’ll get all the household members.
in the second iteration of this repeat group, i want the household members without the members i selected in the first group.

i could add a filter and say “not(selected(householdnames, group multi select))” but that would mean that as soon as a member is selected, they would disappear from the multi-select. so, no room for errors there. I need this filter to only trigger once the answer’s been completed and not every time a selection is made. this is a multi-select.

if it wasn’t in a repeat group it’s pretty straight forward. but i need to keep this grouping question in a repeat that depends on user input because we do not know how many groups will be created.

any ideas?

Mazz

This sounds like a finicky problem - I imagine you’ll have to play around with it considerably to get something working.

i could add a filter and say “not(selected(householdnames, group multi select))” but that would mean that as soon as a member is selected, they would disappear from the multi-select

Have you tested that out?

It sounds like what you really want in place of “group multi select” is “group multi selects before this iteration”. Iterations in a repeat group have an index, you maybe able to leverage that to make the selected function filter on only multi-selects where the repeat group index is less than the current position().

This page describes some tools for working with repeat groups. I’d explore using position() to filter the multi-select in the expression tester while checking the form submission XML for reference.

This is a complex task, and I’m not 100% certain it’s possible. Please let us know if you’re able to get something working!

Hi Ethan

thanks for the help! yeah. that’ll do the trick with some exceptions:

if the name i’m about to check was used in a repeat position after the position i’m in (for example, someone made a mistake and went back to modify something, or added more names to the household member’s repeat, all the names in the positions after the one i’m currently in won’t go through the filter.

but perhaps behavior will change from what i expect when i try that out.

will give it a shot and see how it goes

thanks again