添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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!

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!

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.

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!

Souirji_Abdelghani:

(${actor} = ‘tun_trader’) or (${actor} = ‘SecondPossibility’) or (${actor} = ‘ThirdPossibility’)

that I have offered as a solution in https://forum.getodk.org/t/select-multiple-and-relevance/10156 ?

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.

Hi @LN and @arqaam ,

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

Thanks a lot.

lueu:

when you select 2 of the choices, e.g., C and/or D, I want the succeeding question to show.

See the count-selected() function. Specifically, probably something like this on your succeeding question should do the trick:

relevant: 'count-selected(${q1}) = 2'

If there are specific responses that are of interest - in your case, apparantly only 2 (C & D) - and you don't really care about any additional selections, then I'd probably suggest using a selected() relevant expression, instead of the option-agnostic count-selected(). eg

relevant: 'selected(${q1}, "C") or selected(${q1}, "D")'

Have a play around with this:

choices.xls (19.5 KB)

Screen Shot 2023-05-30 at 6.34.39 PM 555×761 21.5 KB lueu:

when the two choices of interest are both selected and/or when either of the choices is selected.

Can you please post the form you are attempting; the above or logic should be what you desire; namely, the following question is shown (ie relevant) when "user-selected-C or user-selected-D" (either or both) is true.