In a repeat group, How I can Filter out what was selected in all previous repeats for the same question in each new repeat?

I have a select_one question In a repeat group, in each repeat screen, I want to ask about the options that were not selected in all the prior repeat groups.

I found a solution that does this but based on a previous different question, using the functions, “not()” and “selected()” in your choice_filter expression. but what I want is what to do if I want to filter the list of the same question in each repeat group only to show the options that were not selected in all the previous repeats.

I feel the solution would be something like:

not(selected(${pointer to the same question in all previous repeats}, filter))

Is it possible? How to point to the same question in all the previous repeats?

Some help, please!

Now I know how to do it,
As answered in this link

The solution is as follows:

  • Create a select_one field with the items you wish to ask follow-up questions about inside a repeat group (let’s call it “choice” in this example).
  • Give all choice list items unique filter values equal to the choice list values.
  • Give the repeat group an appropriate repeat_count value, most likely one equal to the number of items in the choice list for the “choice” field.
  • Create a calculate field outside the repeat group and name it “calc_join” (for example), with the expression, “join(’ ', ${choice})”. This will create a space-separated value list of the selections made in the repeated field, “choice”.
  • Give “choice” the choice_filter expression, "${choice} = filter or not(selected(${calc_join}, filter))’’. The part of this expression before “or” is critical, as it tells SurveyCTO to always regard the current selection in “choice” to be one of the displayed choices, even if the second part of the expression would otherwise filter it out.

There is a dedicated sample form to see how this works that you can view here

2 Likes

Thank you for sharing the solution to the entire community and making the community a learning and sharing platform @nmcp-yemen! Expecting the same in the upcoming days too.