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’)
How am I supposed to complete this step. Please help.

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’)
How am I supposed to complete this step. Please help.


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.

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.

··· On Saturday, 2 July 2016 00:47:18 UTC+5:30, rselwitz wrote: > > 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 <dr.su...@gmail.com > 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') >> How am I supposed to complete this step. Please help. >> >> -- >> 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-user...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > >

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)

··· On Saturday, 2 July 2016 13:23:53 UTC+5:30, Dr. Sushodh Bhadange wrote: > > 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. > > > On Saturday, 2 July 2016 00:47:18 UTC+5:30, rselwitz wrote: >> >> 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') >>> How am I supposed to complete this step. Please help. >>> >>> -- >>> 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-user...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >>

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

··· On Saturday, July 2, 2016 at 1:53:55 PM UTC+5:30, Dr. Sushodh Bhadange wrote: > > > > 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') > > On Saturday, 2 July 2016 13:23:53 UTC+5:30, Dr. Sushodh Bhadange wrote: >> >> 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. >> >> >> On Saturday, 2 July 2016 00:47:18 UTC+5:30, rselwitz wrote: >>> >>> 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 >> >>>> 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') >>>> How am I supposed to complete this step. Please help. >>>> >>>> -- >>>> 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-user...@googlegroups.com. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>>