Display conditions - and & or

Hi, I want to display a question based on two scenarios -
I have 3 questions: a, b and c

I want to display a question if ‘a and b’ are both met ‘or c’ is met. BUT
not just a or b … so I could use ‘all’ or ‘any’… Is this possible?

instance(‘commcaresession’)/session/user/data/country = ‘Nigeria’ and
#form/B_Country_details_patients_name_label/is_the_patient_from_nigeria =
‘yes’ or #form/'patient_country_not_user_country = ‘Nigeria’

Any thoughts? thanks Nicola

Hi Nicola,

The logic you listed here seems roughly correct to me for this.

If it’s not processing as expected, you can use Parenthesis to ensure that
your AND and OR clauses are evaluated correctly.

So if

A and B or C

is not working right (it’s evaluating B or C first), you can clarify it as

(A and B) or C

which will ensure that A and B is evaluated first. So in this case that
would be

(instance(‘commcaresession’)/session/user/data/country = ‘Nigeria’ and
#form/B_Country_details_patients_name_label/is_the_patient_from_nigeria =
‘yes’) or #form/'patient_country_not_user_country = ‘Nigeria’

Does that answer your question?

-Clayton

··· On Wed, Nov 8, 2017 at 7:10 AM, wrote:

Hi, I want to display a question based on two scenarios -
I have 3 questions: a, b and c

I want to display a question if ‘a and b’ are both met ‘or c’ is met. BUT
not just a or b … so I could use ‘all’ or ‘any’… Is this possible?

instance(‘commcaresession’)/session/user/data/country = ‘Nigeria’ and
#form/B_Country_details_patients_name_label/is_the_patient_from_nigeria =
‘yes’ or #form/'patient_country_not_user_country = ‘Nigeria’

Any thoughts? thanks Nicola


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.