Validate/Filter Linked Multiselect Question

Hello,

I’m trying to validate/filter a multi-select question which is linked to a list question.

The ideal question structure would be as follows:

List Question(members in household) ->Multi-Select Question(select only two members from household) ->Multi-Select Question(show only previous selected members) OR (gives error when members who weren’t selected in previous question is selected)

Your assistance is appreciated.

Regards

As far as I know, I don’t think you can filter a linked multiselect question (at least not linked to a list question) so you will have to make it a validation condition on the second multiselect question which is not ideal.

Let’s say for variable names:
q1 = Multi-Select Question (select only two members from household)
q2 = Multi-Select Question (show only previous selected members)

As a validation condition on q2, you should put:
q1.Contains(self.Last())

That should give you an error when a member is selected in q2 was not selected in q1.

1 Like

Thank you for responding. This was really helpful. Would it be possible for you to tell me where I can get a full syntax guide? I can’t recall seeing self.Last() anywhere in the documentation.

Regards

There are some syntax guides on the support page but I do not think any of them talks about syntax for linked multi-select questions.

self refers to the current question. In this example, self is the same as writing q2. It’s better to use self in validation conditions so you do not have to change your code if the variable name for the question changes. Also makes copying and pasting code for validation conditions easier.

.Last() is necessary to get the values of the response to the linked multiselect question (in this example, the responses recorded for q2) because of the data type that a linked multi-select question is.

1 Like

Thank you so much for your assistance.