Survey Solutions user Giselle del Carmen has sent the following question:
I have a single select question with 11 answer options. I want to filter the answer options displayed based on responses from previous questions. This is the syntax I’ve been trying but I get the error “expected”. How do I include several filter options for the same question?
(@optioncode==3 && p1_03==3) || ///
(@optioncode.InList(7,8,9,10,11) && p1_02==2) || ///
(@optioncode.InList(2,6) && p1_06==3) || ///
(@optioncode==7 && p1_05==3) ///
no need to put /// at the end of the line like you do. the whole content is still one expression (aka one line). This is probably a habit inherited from Stata coding, where this is used to denote line continuation, but is redundant here. See also.
it is not possible to establish syntax errors without knowing the types of all the identifiers involved, there is no such information in your post.
Assuming that p1_* are single-select categorical questions, I don’t see anything suspicious from eyeballing your code, but the context matters. Also the error could be not in the filtering condition, but e.g. in enabling or validation condition.
the error message was probably more specific and you’ve picked some text from it. original message could be more informative than your selection.
it looks like options 1 and 4 will never be shown. It is unlikely that you meant that way, but it is not the reason for the error.