Count using several conditions based on Roster (part 2)

A similar to previous post (sorry for double posting, previous was left as a comment)

I need to enable section if a number of alive children from the roster for one woman is either above 0 or equal 0. However, it doesn’t accept the expressions.

The warning is - Operator > cannot be applied to operands of type bool and int.
Both q216 and p216 (child being alive) are categorical single select with a dichotomous choice of 1 (yes) and 2 (no).

ros.Count(x=>(x.q216==1)>0 || ros_preg.Count(x=>(x.p216==1)>0
ros.Count(x=>(x.q216==1)==0 || ros_preg.Count(x=>(x.p216==1)==0

I tried this, but still unsuccessful:

ros.Count(x=>(x.q216==1)>0) || ros_preg.Count(x=>(x.p216==1)>0)
ros.Count(x=>(x.q216==1)==0) || ros_preg.Count(x=>(x.p216==1)==0)

I am sure it is problem with parenthesis again but can’t figure out the correct combination. Suggestions are very welcome.

I suppose the fix could be to create a number of intermediate variables:
But it also gives an error: [WB0027]:Expression has a syntax error.

Any suggestions are very welcome, thank you beforehand.


write: ROSTERNAME.Count(something)>0
not ROSTERNAME.Count(Something>0)

For novice users I recommend to avoid complex expressions and use more of the intermediate variables.

E.g. define nadults=MEMBERS.Count(m=>m.age>15)

then you can write in enabling or validation conditions: nadults>3

Best, Sergiy Radyakin

Fantastic, thank you!