# Hidden Values Tutorial Part 3: If Statements

I am going through this tutorial - if statements. I find that there are no
steps given in the tutorial for this expression - if(/data/total_children >
5 and /data/feeling_sick = ‘yes’,‘high_risk’,‘low_risk’)

Hello,
Would you be able to elaborate on what specifically you need help with?

To recap the if statement tutorial:

If statements are always in the same format:
if(a,b,c)
This means if a is true, then the answer is b, otherwise/else (i.e. if a is
not true), then the answer is c.

In the expression from the tutorial,

if(/data/total_children > 5 and /data/feeling_sick =
‘yes’,‘high_risk’,‘low_risk’)

/data/total_children > 5 and /data/feeling_sick = ‘yes’ = a
’high_risk’,= b
and ‘low_risk’= c

If the total number of children is more than 5 and the patient is feeling
sick then they are high risk, otherwise they are low risk.

Please let me know if you’d like any further clarification.
Thanks!

Robin Selwitz

··· On Fri, Jul 1, 2016 at 2:35 PM, Dr. Sushodh Bhadange wrote:

I am going through this tutorial - if statements. I find that there are no
steps given in the tutorial for this expression - if(/data/total_children >
5 and /data/feeling_sick = ‘yes’,‘high_risk’,‘low_risk’)

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

Thank you so much for your reply Robin. Actually I’m going through the
tutorial and I am not able to build the XPath Expression for the hidden
value pregnancy_risk. Could you please elaborate the steps to that.
Thanking you in anticipation.

Here is a screenshot where I’m not able to proceed to achieve this
calculate condition if(/data/total_children > 5 and /data/feeling_sick =
‘yes’,‘high_risk’,‘low_risk’)

Auto Generated Inline Image 1 (63.4 KB)

Hi,
According to your screenshot, the expression is not complete in the
calculate condition.

The correct expression should be: if(/data/total_children > 5 and
/data/feeling_sick = ‘yes’,‘high_risk’,‘low_risk’)

Thus, if the total number of children is more than 5 and the patient is
feeling sick then the output will be given as ‘high_risk’, otherwise the
output will be ‘low_risk’

Hope this helps.

Best,

Kishan