Select Multiple and Relevance

What is the problem? Please be detailed.
Hello ODK Forum Members,
I have 2 similar, but separate issues. I am using xls form with Kobotoolbox and need the questionnaire only be displayed online (using Kobo's instance of Enketo).

Problem 1
select_multiple question A. The question has 10 answer options, and for 3 of them the same follow-up question is asked. Under relevant, I have succeeded with "or" to say ${actor} = 'tun_trader' or ... to make it work. And as long as only one of the three relevant options is chosen, all works fine. But if two or all three are chosen, the follow-up question is not displayed in the web-form (I have not tried in the app, as I need it to work in the web-form).

I have tried to think of all solutions and add more "or" options where the two/three options are combined with "and", but it does not work.

Problem 2
Different select_multiple question, again more than 10 options. For two of the options are follow-up questions. But two different ones this time. While all works well with using relevance. This only works if only one of the options is chosen. I would like (read need) it to display both follow-up questions to be displayed, if the two relevant choices in select_multiple question are chosen.

Thank you very much in advance!

1 Like

Hi @arqaam,

Did you use brackets in the relevant column like the expression: (${actor} = ‚Äėtun_trader‚Äô) or (${actor} = ‚ÄėSecondPossibility‚Äô) or (${actor} = ‚ÄėThirdPossibility‚Äô)?

1 Like

the problem is not with the "or" part, its when I select more than one option in the "select_multiple" question.

Hi @arqaam,

Have you tried using the function selected(${variable},'option')?

It would be something like this: selected(${actor},'option1') or selected(${actor},'option2') or selected(${actor},'option3')

yes I have tried it. And it works well, as long as only one of the respective options is chosen, the problem appears when more than one option is chosen, then the follow-up won't appear.

Hi @arqaam,

The problem is that ${actor} contains more than 1 answer if the user select 2 or more answers. If the relevant contains or, this cause a problem because he has chosen and (several answers).
You can try in the relevant column to eliminate the other choices with the expression:

not selected(${actor}, NotDesiredChoice1) and not selected(${actor}, NotDesiredChoice2) and ....

Eliminate all choices except the 3 that are relevant.

Good luck.

this did not work. Also with
not(selected(${actor}, 'NotDesiredChoice1'))

I think the problem is with the "select_multiple" and actually choosing multiple. I found a workaround with a ranking and select_one.

Thank you for your suggestion nonetheless!

selected(${actor}, 'choice1') or selected(${actor}, 'choice2') should work. Please post a form isolating just that question and the question that should be relevant or not.


Problem 1: see Helene's answer.

Problem 2: "...if the two relevant choices in select_multiple question are chosen" then both the dependent followup questions (or a group around them both) need relevant = selected(${actor}, 'choice1') and selected(${actor}, 'choice2') . Note, you didnt say "... if and only if the two relevant choices...", which would require a more comprehensive test to explicitly ensure nothing else was selected.

1 Like

Hi Helene,
I had not read properly, and your solution works for both problems! I apologies for the confusion. I had read on xlsform, that you now can use ${likes_pizza} = ‚Äėyes‚Äô, but failed to read that it's only used for select_one options, or if you do not want to allow others!

Thank you very much for your answer and solution. Highly appreciated!

1 Like

Hi @LN,

Doesn't it come to the same as

that I have offered as a solution in

I read on xlsform about it. Your option only works with select_one or if you only ant one answer option of a select_multiple question. As soon as you want others options to be selected, while you have a relevance on your chosen option, you need to write the relevant, in the way Helene did it.

1 Like

Glad it's working, @arqaam!

@Souirji_Abdelghani I think your solution would be perfect for a select_one or when only one option is selected but not when multiple options are selected. For example, the value of actor could be 'tun_trader SecondPossibility ThirdPossibility' if all three are selected or 'tun_trader foo bar' if 'tun_trader' and two unrelated options are selected. In those cases, all three of your checks would fail but the intent is that the whole statement be true if any of the possibilities are selected.

1 Like

Hi @LN and @arqaam,

You're both right. I indeed have overlooked that fact; sorry for that.

Thanks a lot.