Multiple relevance condition

Hello, I want a Group of questions to show only if female users are the ones asking the question and the respondent is a female. I tried using “or” with “and” but it did not work.

Hi @holyemee and welcome to the community!

Can you share screenshots of:

  • Label of your relative questions.
  • Label of your relative answers.
  • And the relevance of the group.
1 Like

Welcome @holyemee,
or and and cannot be on the same level, so you would need to put the parts in brackets (…).

Did you check your form with the Online Validator ODK - XLSForm Online v2.x ? This is always recommended during development.

Trying the search function of the forum, can also provide help often, see e.g.
https://community.kobotoolbox.org/t/use-of-if-condition-on-responses-of-multiple-choice-question-for-a-calculate-question/33608/13.

@Kal_Lam : There seems to be no hint in the Help Center articles for this. Might be preferable to add? Maybe include the general precedence hint of XWare, see Restricting a date variable using month-year on XLS - #8 by Xiphware

2 Likes

Thanks for the support. I have been able to resolve it using;

${fa_type} = ‘female_fa’ and (${ra_name}=‘2’ or ${ra_name}=‘6’ or ${ra_name}=‘9’ or ${ra_name}=‘12’ or ${ra_name}=‘18’)

1 Like

@holyemee, :clap: :heart: :partying_face:

[quote=“wroos, post:3, topic:34161, full:true”]

@Kal_Lam : There seems to be no hint in the Help Center articles for this. Might be preferable to add? [/quote]

Thank you, @wroos. Yes, I agree with you. I have marked it as a to-do list for the near future.

1 Like

Is there a way to have multiple distinct in the same relevant? like

${institucion} != "velaz" or ${institucion} !=  "miguel_pedro" or ${institucion} !=  "gabriel"

You have any idea @Kal_Lam ??

This seems to be a problem of your logic. Not a or not b or not c or not … This will only evaluate to false, if not a + b + c + … selected all together (even with something else).
Example: if only a selected, “or not b” is true. (Same if only a selected with something not noted here.)

You probably want:
not( selected(${institucion}, “velaz” or selected(${institucion}, “miguel_pedro” or … ).
But this would also evaluate to false if one of these listed values is combined with another choice.

Could you provide more details, please, what you exactly want to achieve with the relevant clause?

Hint: For multiple selects you need to use selected(…) here, see ODK XForms Specification and Help Center article Adding Skip Logic — KoboToolbox documentation.

@Kal_Lam. As there are many postings around select combinations/exclusions, count limits, choice_filters etc., it might be preferable to enhance the Help Center documentation with related examples (solution patterns).

Hi! Thanks for answering. To explain better my situation: at the start of my form, I selected one type of question, which have like 15 options. Then I have a section that I want only to appear to most of the options. That’s why I am curious if there is any way to exclude those options in a tidy way.
For example, my option are A, B, C, D, E, F, G, H, and the section of the question should not appear as C, F or H.
I wonder if there is a syntax to only exclude those options in the relevance section, like ${question} != 'C' or ${question} != 'F' or ${question} != 'H'.
Right now I have like the large solution of including all the correct options, but it is tedious to do it that way

Is this a select or a select_multiple question/variable type?
Would you mind to study the feedback above, please, esp. for the logic issue.

It is a selec_one type of question, and yeah! will test it and give feedback

So, it becomes easier:
You probably want:
not( ${institucion} = “velaz” or ${institucion} = “miguel_pedro” or … ).
Also possible would be:
${institucion} != “velaz” and ${institucion} != “miguel_pedro” and … ).

Hint: Nothing selected would also evaluate to true.