Better programming practice for jump logic in select-multiple


I have a select-multiple question with around 10 answer options. 8 of them, when selected individually, are triggering another group that is asking for more details. The other 2, should NOT be triggering that follow-up details group.

In the RELEVANCE field in front of the group, if I put not(selected(#9 or #10)), it works OK for options 9 and 10, but the group gets triggered even on no selections done from options 1 to 8 (since that's how not-selected is designed to work). This means I need to put a long relevance condition listing all options from 1 to 8 (i.e. selected(#1) or selected (#2)....). I assume this is not a good coding practice.

Perhaps I am missing some very small or basic logic here, but would appreciate some help in finding a better solution.


Hi Saad,
You could try using your notselected with and ${yourquestion} != "". However, not sure if that will work. Let me know!

Alternatively you can also add an invisible calculate field that is set to 1 if the user selected eiter 9 or 10 in your question. You can then use this field for your relevant condition of the next question:
${calc_field} != 1

try running this, eg here:

multiselect.xlsx (9.4 KB)

As @JonasWeinert alludes to, I think you just needed to add an additional check that the multi-select was in fact answered, and only then check neither 9 or 10 were selected.

Hi all,

It's a real brain-teaser now, as I have tried dozens of combination including what @Xiphware and @JonasWeinert have mentioned. But somehow, the correct answer is not triggering. Even on paper, I am having a hard time making its logic/truth table.

A bit rephrasing of trivia if it helps: Q1 is multi-select and has 10 options. Q2 asks for details of the option. Q2 should be triggered only if options 1 to 8 are selected, and it should 'ignore' selection (or non-selection) of options 9 and 10. So, a rough truth table be:

Q1=1 ----------------- Q2=Triggered
Q1= 9 ----------------- Q2=Not-triggered
Q1=10 -----------------Q2=Not-triggered
Q1=1,2,3,4,5,6,7,8 -----------------Q2=Triggered
//Here comes the complex part
Q1=1,9 ------------------Q2=Triggered (since option 1 is selected)
Q1=2,9,10 --------------Q2=Triggered (since option 2 is selected)

The truth table logics that I have tested so far, the last 2 scenarios cannot be made to work somehow, since selection of 9 or 10 actually changes the whole equation to FALSE, and Q2 does not get triggered although option 1 to 8 are in selection.

I miss university days... :slight_smile:

Help please, anyone?
multiselect.xlsx (10.4 KB)

Hi Saad,
I am just seeing this. I don't know if this is out of place. But I will appreciate it if you could re-share the original question and the associated xlsform. This will help understand and contribute.

Hi @Charles_Okoro. The question description is in the above message in detail. I also added the xls file as well.

Thanks for the clarification. Try this one instead:
multiselect2.xlsx (9.4 KB)

Basically, the trick I'm using is to count the number of selected options (via the count-selected() function), 'ignoring' [sic] the selection of 9 or 10 by subtracting them if they do happen to be selected (via knowing the number() function will conveniently convert true to 1 for me... :slight_smile: ), and then making sure there's still something selected.