Error message with hidden value calculation

Hi, I have a hidden value (hf_total_cemonc) which is performing the
following calculation, however, I only want it to sum and present this
score in my data, if another hidden value (hf_status2) has a specific
output (otherwise I would like the cell to remain blank i.e. no
score calculated) however I keep getting error messages and am not sure why.

if(/data/hr/hr1_routine_del = ‘1’, 10, 0) + if(/data/hr/hr2_assisted_del =
‘1’, 10, 0) + if(/data/hr/hr3_placenta = ‘1’, 10, 0) +
if(/data/hr/hr4_vacuum = ‘1’, 10, 0) + if(/data/hr/hr5_newborn_resus = ‘1’,
10, 0) + if(/data/hr/hr6_c_section = ‘1’, 10, 0) +
if(/data/hr/hr7_anaesthesia = ‘1’, 10, 0) + if(/data/hr/hr8_transfusion =
‘1’, 10, 0) + if(/data/hr/hr9_labtech = ‘1’, 5, 0) +
if(/data/hr/hr10_fp_long = ‘1’, 5, 0) + if(/data/hr/hr11_fp_perm = ‘1’, 5,
0) + if(/data/hr/hr12_supply_chain = ‘1’, 5, 0)

I only want the the above to be calculated if(hf_status2= “CEMONC”).
if(/data/hf_status2=“BEMONC”, then I would like the score / cell to remain
blank.

I have tried variations such as the following.

if(/data/hf_status2=“BEMONC”,".", if(/data/hr/hr1_routine_del = ‘1’, 10,
0) + if(/data/hr/hr2_assisted_del = ‘1’, 10, 0) + if(/data/hr/hr3_placenta
= ‘1’, 10, 0) + if(/data/hr/hr4_vacuum = ‘1’, 10, 0) +
if(/data/hr/hr5_newborn_resus = ‘1’, 10, 0) + if(/data/hr/hr6_c_section =
‘1’, 10, 0) + if(/data/hr/hr7_anaesthesia = ‘1’, 10, 0) +
if(/data/hr/hr8_transfusion = ‘1’, 10, 0) + if(/data/hr/hr9_labtech = ‘1’,
5, 0) + if(/data/hr/hr10_fp_long = ‘1’, 5, 0) + if(/data/hr/hr11_fp_perm =
‘1’, 5, 0) + if(/data/hr/hr12_supply_chain = ‘1’, 5, 0)

if(/data/hf_status2=“BEMONC”,", if(/data/hr/hr1_routine_del = ‘1’, 10, 0)

  • if(/data/hr/hr2_assisted_del = ‘1’, 10, 0) etc.

I assume I am missing something before the 2nd ‘if’, or am doing something
wrong with the brackets, but am not sure what that is? Can anyone help?

Also, with Commcare, what the symbol for missing / blank (i.e. like in the
above, where if the condition is met, the cell remains blank)

Hey Sarah,

I think you could accomplish what you’re trying for a bit more cleanly by
adding

hf_status2= “CEMONC”

as a display condition to your hidden value. If this condition is false,
then the value will not be calculated. Also (random suggestion) when
composing large calculations using a text editor with brace matching
https://en.wikipedia.org/wiki/Brace_matching can be very helpful

If this doesn’t resolve the bug, could you post the error message you’re
seeing?

Also, with Commcare, what the symbol for missing / blank (i.e. like in the
above, where if the condition is met, the cell remains blank)

Generally on mobile a “null” data node will simply not exist in the
instance so you’d test for this using the count() function. In exports
blank values will often be encoded with ‘—’

Hi Will, thanks for your suggestion - I’m pretty sure I tried that but will
try again and if it doesn’t work will let you know the error message.
Thanks,
Sarah

··· On Thursday, 25 February 2016 22:21:35 UTC, William Pride wrote: > > Hey Sarah, > > I think you could accomplish what you're trying for a bit more cleanly by > adding > > hf_status2= "CEMONC" > > as a display condition to your hidden value. If this condition is false, > then the value will not be calculated. Also (random suggestion) when > composing large calculations using a text editor with brace matching > can be very helpful > > If this doesn't resolve the bug, could you post the error message you're > seeing? > > >> Also, with Commcare, what the symbol for missing / blank (i.e. like in >> the above, where if the condition is met, the cell remains blank) >> >> > Generally on mobile a "null" data node will simply not exist in the > instance so you'd test for this using the count() function. In exports > blank values will often be encoded with '---' > >