Sum of the value outputs from checkbox questions

9 views
Skip to first unread message

Jithin Chandran

unread,
Nov 16, 2017, 4:27:05 AM11/16/17
to commcare-users
if(#form/check_your_progress/what_are_the_components_of_the_blood = 'red_blood_cells', 1,0)+ 
if(#form/check_your_progress/what_are_the_components_of_the_blood = 'white_blood_cells', 1,0)+ 
if(#form/check_your_progress/what_are_the_components_of_the_blood = 'platelets', 1,0)+
if(#form/check_your_progress/what_are_the_components_of_the_blood = 'plasma', 1,0)

Why is this not working? I want to get sum of the value outputs.

Simon Kelly

unread,
Nov 16, 2017, 6:27:25 AM11/16/17
to commcar...@googlegroups.com
I assume that the "what_are_the_components_of_the_blood" question is a multi-answer question type. You need to use the "selected" function:

if(selected(#form/check_your_progress/what_are_the_components_of_the_blood, 'red_blood_cells'), 1,0)+ ....

Simon Kelly
Director of Server Engineer | Dimagi

--
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.

Reply all
Reply to author
Forward
0 new messages