Use of parentheses in display conditions

Hi,

I’m trying to group my display conditions together, but can’t seem to
figure out the correct number and position of the parentheses. My
requirements are outlined below, each row representing one set of
conditions that should be met in order for it to display.

/data/age_list/age < 16
or
/data/age_list/age > 50
or
/data/age_list/age < 18 and /data/age_list/age >= 16 and /data/marry = '1’
or
/data/age_list/age < 18 and /data/age_list/age >= 16 and /data/child_no >= 1

Hi Rachael,

How you have it written should actually work as is. When an expression is
evaluated all the “ands” are evaluated first. Then the “ors” are evaluated
so this will evaluate correctly. For clarity, you could write it out with
parentheses as below but it is not necessary. CommCare will actually remove
the parentheses when you save which may be the behavior that is confusing
you.

/data/age_list/age < 16
or
/data/age_list/age > 50
or
(/data/age_list/age < 18 and /data/age_list/age >= 16 and /data/marry = ‘1’
)
or
(/data/age_list/age < 18 and /data/age_list/age >= 16 and /data/child_no >=
1)

Regards,
Nick

Nick Nestle
Project Manager | Dimagi South Africa
+27 79 439 6081

··· On Mon, Jun 20, 2016 at 11:26 PM, Rachael Sabelli wrote:

Hi,

I’m trying to group my display conditions together, but can’t seem to
figure out the correct number and position of the parentheses. My
requirements are outlined below, each row representing one set of
conditions that should be met in order for it to display.

/data/age_list/age < 16
or
/data/age_list/age > 50
or
/data/age_list/age < 18 and /data/age_list/age >= 16 and /data/marry = '1’
or
/data/age_list/age < 18 and /data/age_list/age >= 16 and /data/child_no >=
1


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.