Checking if at least one option is selected in select_multiple


I have Q1, Q2, and Q3 as 'select multiple' with around 15 options each (diseases). I have a Q4 (saying you must go to doctor), which needs to be displayed if any of the options from Q1 or Q2 or Q3 are selected. If I compute the jump logic with considering all 15 options of each question, it makes a huge formula having 45 OR statements. I don't think it is optimized.

I guess I need to make the jump logic only by checking if the variable for Q1 is set (like isset() function in php); or same for Q2 and Q3. How to do that here? OR any other better answer?


Hi @Saad

You have to use count-selected() function to check if any options is selected for example in your case the relevant for Q4 should be: count-selected(${Q1})>0 or count-selected(${Q2})>0 or count-selected(${Q3})>0

1 Like

Hello @Saad and @rassam,

You could also join concerned nodes with concat() and the use the count-selected() on top of it. It might save you some line of codes.

See below

count-selected(concat(${Q1}, ' ', ${Q2}, ' ', ${Q3}))>0

With regards,
Jules R