Filter multi-select from linked multi-select

Good day Survey Solutions team,

I’ve tried to find a similar scenario to what I’m trying to implement but I can’t find exactly the same outcome. Could you please advise if the below is possible and how I might best implement this or where I might find an example, or if this is not possible, how might I best implement this as closely as possible to what I’m trying to achieve.

I have a hidden list (members_list) containing our members which we pre-load. I then have a multi-select question (mcq_members_1) linked to the members_list. I’m trying to add a second multi-select question (mcq_members_2) which is also linked to the members_list, but with a filter that exclude all selected options in mcq_members_1.

Thank you in advance
Eugene Ehlers

In Survey Solutions linked to list questions may not have a filter.
This is known as issue KP-10171 since about 2017.

Most likely you also have some roster dependent on these members. In which case you could link to that roster. If not, you will need to introduce a fake roster (sigh) or come up with some other strategy (your question is not specific as to what you are doing). If you are doing something like a panel survey with known members and new members - there is almost certainly a different way of doing it.

Staying within the constraints you specified, explore the example section “Pupils” in the “Public example User questions and common patterns” questionnaire.

Note also that linked questions may not be preloaded (if you are doing a panel study, you have to avoid them in the retrospective part). Consult the following table for supported capabilities by question type:
https://support.mysurvey.solutions/questionnaire-designer/limits/design-limitations-by-question-type/

1 Like

Dear Sergiy,

Thank you for your reply. I’m aware of the known issue regarding linked to list questions and filters, however, I was trying to find an alternative to that. I’ve also been playing around with the ‘fake roster’ approach but that would’ve been my last resort.

Thank you for pointing out the ‘pupils’ section, it is a great example. I’ll play around some more and see how I can best implement my filters taking your advise in consideration.

kind regards
Eugene Ehlers

Dear Sergiy,

I’ve been trying to implement the filter logic as per our discussion above but I’m currently stuck on the variable @rowcode.

I’ve developed a demo questionnaire “Multiselect Filter” which I made public (not sure if you are able to view the Questionnaire). A quick overview of the Questionnaire is as follow.

I have a household roster, within the household roster I have my multi-select questions which are linked to members roster which follow my multi-select questions (members roster are located below my multi-select questions but also within the household roster). I’m trying to filter my multi-select questions so that the members that was selected in the first multi-select question be removed from the second and third and same for the members selected in the second should be removed from the member displayed in the third.

I’m using the below code to filter my second multi-select question (members_migrate is the name of my first multi-select question):

 !members_migrate.Any(p=>p[0]==@rowcode) 

The problem is that my multi-select filters currently reads the @rowcode of the current roster (household roster), which I understand, but how can I point my @rowcode variable to use the members_roster?

I’ve also uploaded the two different Questionnaires to the Survey Solutions Demo server (“Multiselect Filter” & “Multiselect Filter_Only One Roster”). The questionniare “Multiselect Filter_Only One Roster” is how i would like to filter my multi-select questions but the questionnaire “Multiselect Filter” is my current questionnaire outline (with two rosters).

Could you kindly advice?

Kind regards

Eugene Ehlers

The filter of the linked question in Survey Solutions is evaluated in the context of the SOURCE of the items. This allows, for example, to write a condition AGE>=18 to select all adult members. The system variable @rowcode is also interpreted as the rowcode of the candidate selection.

If you need to return to the current context of where your question is positioned, you use the @current prefix. For example, @rowcode!=@current.@rowcode will keep all the persons, except the current person (such as in the question “who is your best friend in class?”).

There is a bunch of examples in the public questionnaires, look at the one dealing with establishing the relationships in the family, such as “Household Roster”

PS: I looked at the example you mention “Multiselect Filter_Only One Roster”. It’s beyond my comprehension, so the above advice is solely based on the quoted description of the problem.

Hope this helps, Sergiy

Dear Sergiy,

Thank you for your reply, but I’ve managed to resolve my issue.

Because of my roster layout I had to change the array position. Hope this could be helpful to someone else. Just to give a brief over view of my questionnaire layout again:

I have a Household list question that list all the households at a specific location (AA, AB, AC…)
I have a list roster (household roster) that is linked to my Household list.
Within my Household roster I have the following questions.

  • A list question that list all the members at the current Household roster index
  • A Multi-Select question that is linked to the nested members roster (Members roster follows just before the end of my household roster).
  • Another Multi-Select question that is also linked to the nested members roster and has a filter to exclude any members that was selected in the first Multi-Select question.
  • Finally I have a nested list roster (members roster) that is linked to my members list question.

To properly set up the filter in my second Multi-Select question I had to change my code as shown below.

Old Code

 !members_migrate.Any(p=>p[0]==@rowcode)

New Code

 !members_migrate.Any(p=>p[1]==@rowcode)

Kind regards

Eugene Ehlers

New features of the software allow a solution without a fake roster to be involved. The example questionnaire mentioned above has been updated to not use a fake roster.

https://designer.mysurvey.solutions/questionnaire/details/04b421596f0443e88cd99ec0538d89ff/chapter/dc11d41224232eb0f8316a87da252e21

1 Like

Thank you Sergiy, will have a look.