Hidden Values - Assigning Values to Multiple Choice Responses

I’m wondering if there is a way to apply a hidden value “if statement” in
order to assign values to multiple choice responses. Essentially, I want
the exported data set to include a score based on individual case
responses. For example, for a question about level of physical activity
with responses, HIGH, MEDIUM, and LOW, I want to assign a score of 3 to all
HIGH responses, 2 to all MEDIUM responses, and 1 to all LOW responses.

Below are two variations that I’ve tried with no success.

if(/data/physical_activity = ‘HIGH’, 3, if(/data/physical_activity =
‘MEDIUM’, 2, if(/data/physical_activity = ‘LOW’, 1, 0)))

if(/data/physical_activity = ‘HIGH’, 3) or if(/data/physical_activity =
‘MEDIUM’, 2) or if(/data/physical_activity = ‘LOW’, 1)

Any thoughts?

Hi Ryan,

The first of these options should definitely be working. Are you sure that
’HIGH’ is the value of the multiple choice question, and not the label?
If you look at the submitted form, what are the contents of the
physical_activity question data?

-Clayton

··· On Fri, Jul 8, 2016 at 9:41 AM, Ryan Seguin wrote:

I’m wondering if there is a way to apply a hidden value “if statement” in
order to assign values to multiple choice responses. Essentially, I want
the exported data set to include a score based on individual case
responses. For example, for a question about level of physical activity
with responses, HIGH, MEDIUM, and LOW, I want to assign a score of 3 to all
HIGH responses, 2 to all MEDIUM responses, and 1 to all LOW responses.

Below are two variations that I’ve tried with no success.

if(/data/physical_activity = ‘HIGH’, 3, if(/data/physical_activity =
‘MEDIUM’, 2, if(/data/physical_activity = ‘LOW’, 1, 0)))

if(/data/physical_activity = ‘HIGH’, 3) or if(/data/physical_activity =
‘MEDIUM’, 2) or if(/data/physical_activity = ‘LOW’, 1)

Any thoughts?


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.

Clayton,

Your response gave me confidence and when I tried to deploy it again, it
worked!

Thanks,
Ryan

··· On Friday, July 8, 2016 at 10:06:42 AM UTC-4, Clayton Sims wrote: > > Hi Ryan, > > The first of these options should definitely be working. Are you sure that > 'HIGH' is the _value_ of the multiple choice question, and not the label? > If you look at the submitted form, what are the contents of the > physical_activity question data? > > -Clayton > > On Fri, Jul 8, 2016 at 9:41 AM, Ryan Seguin <j.ryan...@gmail.com > wrote: > >> I'm wondering if there is a way to apply a hidden value "if statement" in >> order to assign values to multiple choice responses. Essentially, I want >> the exported data set to include a score based on individual case >> responses. For example, for a question about level of physical activity >> with responses, HIGH, MEDIUM, and LOW, I want to assign a score of 3 to all >> HIGH responses, 2 to all MEDIUM responses, and 1 to all LOW responses. >> >> Below are two variations that I've tried with no success. >> >> if(/data/physical_activity = 'HIGH', 3, if(/data/physical_activity = >> 'MEDIUM', 2, if(/data/physical_activity = 'LOW', 1, 0))) >> >> if(/data/physical_activity = 'HIGH', 3) or if(/data/physical_activity = >> 'MEDIUM', 2) or if(/data/physical_activity = 'LOW', 1) >> >> Any thoughts? >> >> >> -- >> 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. >> > >

Great to hear! Please feel free to reach out if you have any other
questions.

Cheers,
-Clayton

··· On Fri, Jul 8, 2016 at 10:41 AM, Ryan Seguin wrote:

Clayton,

Your response gave me confidence and when I tried to deploy it again, it
worked!

Thanks,
Ryan

On Friday, July 8, 2016 at 10:06:42 AM UTC-4, Clayton Sims wrote:

Hi Ryan,

The first of these options should definitely be working. Are you sure
that ‘HIGH’ is the value of the multiple choice question, and not the
label? If you look at the submitted form, what are the contents of the
physical_activity question data?

-Clayton

On Fri, Jul 8, 2016 at 9:41 AM, Ryan Seguin j.ryan...@gmail.com wrote:

I’m wondering if there is a way to apply a hidden value "if statement"
in order to assign values to multiple choice responses. Essentially, I want
the exported data set to include a score based on individual case
responses. For example, for a question about level of physical activity
with responses, HIGH, MEDIUM, and LOW, I want to assign a score of 3 to all
HIGH responses, 2 to all MEDIUM responses, and 1 to all LOW responses.

Below are two variations that I’ve tried with no success.

if(/data/physical_activity = ‘HIGH’, 3, if(/data/physical_activity =
‘MEDIUM’, 2, if(/data/physical_activity = ‘LOW’, 1, 0)))

if(/data/physical_activity = ‘HIGH’, 3) or if(/data/physical_activity =
‘MEDIUM’, 2) or if(/data/physical_activity = ‘LOW’, 1)

Any thoughts?


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.


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.

I am working on something exactly the same but am getting an error:

if(/data/easy_lace = ‘EASY’, 14.28571, if(/data/easy_lace = ‘FAIR’,
7.1428571, if(/data/easy_lace = ‘DIFFICULT’, 0)))

I am missing my “OTHERWISE this”/“result if statement is false” value but
I’m not sure what to use for my “OTHERWISE this” or “result if statement is
false” value.

Here’s the error… thanks!

Problem with bind for /data/Easy_to_put_shoe_on_score contains invalid
calculate expression [if(/data/Easy_shoe = ‘EASY’, 14.28571,
if(/data/Easy_shoe = ‘FAIR’, 7.1428571, if(/data/Easy_shoe = ‘DIFFICULT’,
0)))] if() function requires 3 arguments but 2 are present. in form

··· On Friday, July 8, 2016 at 12:23:11 PM UTC-4, Clayton Sims wrote: > > Great to hear! Please feel free to reach out if you have any other > questions. > > Cheers, > -Clayton > > On Fri, Jul 8, 2016 at 10:41 AM, Ryan Seguin <j.ryan...@gmail.com > wrote: > >> Clayton, >> >> Your response gave me confidence and when I tried to deploy it again, it >> worked! >> >> Thanks, >> Ryan >> >> On Friday, July 8, 2016 at 10:06:42 AM UTC-4, Clayton Sims wrote: >>> >>> Hi Ryan, >>> >>> The first of these options should definitely be working. Are you sure >>> that 'HIGH' is the _value_ of the multiple choice question, and not the >>> label? If you look at the submitted form, what are the contents of the >>> physical_activity question data? >>> >>> -Clayton >>> >>> On Fri, Jul 8, 2016 at 9:41 AM, Ryan Seguin wrote: >>> >>>> I'm wondering if there is a way to apply a hidden value "if statement" >>>> in order to assign values to multiple choice responses. Essentially, I want >>>> the exported data set to include a score based on individual case >>>> responses. For example, for a question about level of physical activity >>>> with responses, HIGH, MEDIUM, and LOW, I want to assign a score of 3 to all >>>> HIGH responses, 2 to all MEDIUM responses, and 1 to all LOW responses. >>>> >>>> Below are two variations that I've tried with no success. >>>> >>>> if(/data/physical_activity = 'HIGH', 3, if(/data/physical_activity = >>>> 'MEDIUM', 2, if(/data/physical_activity = 'LOW', 1, 0))) >>>> >>>> if(/data/physical_activity = 'HIGH', 3) or if(/data/physical_activity = >>>> 'MEDIUM', 2) or if(/data/physical_activity = 'LOW', 1) >>>> >>>> Any thoughts? >>>> >>>> >>>> -- >>>> 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. >>>> >>> >>> -- >> 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 Lauren,

The issue here is that your final ‘if’ expression (easy_lace = ‘DIFFICULT’)
is lacking a third argument, which would be the default if the value was
neither EASY, nor FAIR, nor DIFFICULT. You’ll need to provide an output for
that situation to proceed.

-Clayton

··· On Tue, Aug 16, 2016 at 9:28 AM, lauren wall wrote:

I am working on something exactly the same but am getting an error:

if(/data/easy_lace = ‘EASY’, 14.28571, if(/data/easy_lace = ‘FAIR’,
7.1428571, if(/data/easy_lace = ‘DIFFICULT’, 0)))

I am missing my “OTHERWISE this”/“result if statement is false” value but
I’m not sure what to use for my “OTHERWISE this” or “result if statement is
false” value.

Here’s the error… thanks!

Problem with bind for /data/Easy_to_put_shoe_on_score contains invalid
calculate expression [if(/data/Easy_shoe = ‘EASY’, 14.28571,
if(/data/Easy_shoe = ‘FAIR’, 7.1428571, if(/data/Easy_shoe = ‘DIFFICULT’,
0)))] if() function requires 3 arguments but 2 are present. in form

On Friday, July 8, 2016 at 12:23:11 PM UTC-4, Clayton Sims wrote:

Great to hear! Please feel free to reach out if you have any other
questions.

Cheers,
-Clayton

On Fri, Jul 8, 2016 at 10:41 AM, Ryan Seguin j.ryan...@gmail.com wrote:

Clayton,

Your response gave me confidence and when I tried to deploy it again, it
worked!

Thanks,
Ryan

On Friday, July 8, 2016 at 10:06:42 AM UTC-4, Clayton Sims wrote:

Hi Ryan,

The first of these options should definitely be working. Are you sure
that ‘HIGH’ is the value of the multiple choice question, and not the
label? If you look at the submitted form, what are the contents of the
physical_activity question data?

-Clayton

On Fri, Jul 8, 2016 at 9:41 AM, Ryan Seguin j.ryan...@gmail.com wrote:

I’m wondering if there is a way to apply a hidden value "if statement"
in order to assign values to multiple choice responses. Essentially, I want
the exported data set to include a score based on individual case
responses. For example, for a question about level of physical activity
with responses, HIGH, MEDIUM, and LOW, I want to assign a score of 3 to all
HIGH responses, 2 to all MEDIUM responses, and 1 to all LOW responses.

Below are two variations that I’ve tried with no success.

if(/data/physical_activity = ‘HIGH’, 3, if(/data/physical_activity =
‘MEDIUM’, 2, if(/data/physical_activity = ‘LOW’, 1, 0)))

if(/data/physical_activity = ‘HIGH’, 3) or if(/data/physical_activity
= ‘MEDIUM’, 2) or if(/data/physical_activity = ‘LOW’, 1)

Any thoughts?


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.


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.


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.

Hi Clayton,

Thanks for the response. Yes, I knew I was missing that value, but I’m not
sure what to put for the value - a response is required, so it has to be
one of those 3 values. There is no default value. Do you have a
suggestion for what I use for a third argument? When I used “0”, I had
another hidden value that summed all the questions that were on this 3
point scale and everything defaulted to 0 in that case save for the last
question.

Thanks!
Lauren

··· On Tuesday, August 16, 2016 at 10:01:18 AM UTC-4, Clayton Sims wrote: > > Hi Lauren, > > The issue here is that your final 'if' expression (easy_lace = > 'DIFFICULT') is lacking a third argument, which would be the default if the > value was neither EASY, nor FAIR, nor DIFFICULT. You'll need to provide an > output for that situation to proceed. > > -Clayton > > On Tue, Aug 16, 2016 at 9:28 AM, lauren wall <laurena...@gmail.com > wrote: > >> I am working on something exactly the same but am getting an error: >> >> if(/data/easy_lace = 'EASY', 14.28571, if(/data/easy_lace = 'FAIR', >> 7.1428571, if(/data/easy_lace = 'DIFFICULT', 0))) >> >> I am missing my "OTHERWISE this"/"result if statement is false" value but >> I'm not sure what to use for my "OTHERWISE this" or "result if statement is >> false" value. >> >> Here's the error... thanks! >> >> Problem with bind for /data/Easy_to_put_shoe_on_score contains invalid >> calculate expression [if(/data/Easy_shoe = 'EASY', 14.28571, >> if(/data/Easy_shoe = 'FAIR', 7.1428571, if(/data/Easy_shoe = 'DIFFICULT', >> 0)))] if() function requires 3 arguments but 2 are present. in form >> >> >> On Friday, July 8, 2016 at 12:23:11 PM UTC-4, Clayton Sims wrote: >>> >>> Great to hear! Please feel free to reach out if you have any other >>> questions. >>> >>> Cheers, >>> -Clayton >>> >>> On Fri, Jul 8, 2016 at 10:41 AM, Ryan Seguin wrote: >>> >>>> Clayton, >>>> >>>> Your response gave me confidence and when I tried to deploy it again, >>>> it worked! >>>> >>>> Thanks, >>>> Ryan >>>> >>>> On Friday, July 8, 2016 at 10:06:42 AM UTC-4, Clayton Sims wrote: >>>>> >>>>> Hi Ryan, >>>>> >>>>> The first of these options should definitely be working. Are you sure >>>>> that 'HIGH' is the _value_ of the multiple choice question, and not the >>>>> label? If you look at the submitted form, what are the contents of the >>>>> physical_activity question data? >>>>> >>>>> -Clayton >>>>> >>>>> On Fri, Jul 8, 2016 at 9:41 AM, Ryan Seguin wrote: >>>>> >>>>>> I'm wondering if there is a way to apply a hidden value "if >>>>>> statement" in order to assign values to multiple choice responses. >>>>>> Essentially, I want the exported data set to include a score based on >>>>>> individual case responses. For example, for a question about level of >>>>>> physical activity with responses, HIGH, MEDIUM, and LOW, I want to assign a >>>>>> score of 3 to all HIGH responses, 2 to all MEDIUM responses, and 1 to all >>>>>> LOW responses. >>>>>> >>>>>> Below are two variations that I've tried with no success. >>>>>> >>>>>> if(/data/physical_activity = 'HIGH', 3, if(/data/physical_activity = >>>>>> 'MEDIUM', 2, if(/data/physical_activity = 'LOW', 1, 0))) >>>>>> >>>>>> if(/data/physical_activity = 'HIGH', 3) or if(/data/physical_activity >>>>>> = 'MEDIUM', 2) or if(/data/physical_activity = 'LOW', 1) >>>>>> >>>>>> Any thoughts? >>>>>> >>>>>> >>>>>> -- >>>>>> 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. >>>>>> >>>>> >>>>> -- >>>> 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. >>>> >>> >>> -- >> 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. >> > >

Hey Lauren,

If the datum can only be one of the three values, then you actually don’t
need the last ‘if’ statement (since we can thus assume that its predicate
will be true, by default).

So you could simplify the expression to:

if(/data/easy_lace = ‘EASY’, 14.28571, if(/data/easy_lace = ‘FAIR’,
7.1428571,0))

Cheers,
Will

··· On Tue, Aug 16, 2016 at 11:21 AM, lauren wall wrote:

Hi Clayton,

Thanks for the response. Yes, I knew I was missing that value, but I’m
not sure what to put for the value - a response is required, so it has to
be one of those 3 values. There is no default value. Do you have a
suggestion for what I use for a third argument? When I used “0”, I had
another hidden value that summed all the questions that were on this 3
point scale and everything defaulted to 0 in that case save for the last
question.

Thanks!
Lauren

On Tuesday, August 16, 2016 at 10:01:18 AM UTC-4, Clayton Sims wrote:

Hi Lauren,

The issue here is that your final ‘if’ expression (easy_lace =
‘DIFFICULT’) is lacking a third argument, which would be the default if the
value was neither EASY, nor FAIR, nor DIFFICULT. You’ll need to provide an
output for that situation to proceed.

-Clayton

On Tue, Aug 16, 2016 at 9:28 AM, lauren wall laurena...@gmail.com wrote:

I am working on something exactly the same but am getting an error:

if(/data/easy_lace = ‘EASY’, 14.28571, if(/data/easy_lace = ‘FAIR’,
7.1428571, if(/data/easy_lace = ‘DIFFICULT’, 0)))

I am missing my “OTHERWISE this”/“result if statement is false” value
but I’m not sure what to use for my “OTHERWISE this” or “result if
statement is false” value.

Here’s the error… thanks!

Problem with bind for /data/Easy_to_put_shoe_on_score contains invalid
calculate expression [if(/data/Easy_shoe = ‘EASY’, 14.28571,
if(/data/Easy_shoe = ‘FAIR’, 7.1428571, if(/data/Easy_shoe = ‘DIFFICULT’,
0)))] if() function requires 3 arguments but 2 are present. in form

On Friday, July 8, 2016 at 12:23:11 PM UTC-4, Clayton Sims wrote:

Great to hear! Please feel free to reach out if you have any other
questions.

Cheers,
-Clayton

On Fri, Jul 8, 2016 at 10:41 AM, Ryan Seguin j.ryan...@gmail.com wrote:

Clayton,

Your response gave me confidence and when I tried to deploy it again,
it worked!

Thanks,
Ryan

On Friday, July 8, 2016 at 10:06:42 AM UTC-4, Clayton Sims wrote:

Hi Ryan,

The first of these options should definitely be working. Are you sure
that ‘HIGH’ is the value of the multiple choice question, and not the
label? If you look at the submitted form, what are the contents of the
physical_activity question data?

-Clayton

On Fri, Jul 8, 2016 at 9:41 AM, Ryan Seguin j.ryan...@gmail.com wrote:

I’m wondering if there is a way to apply a hidden value “if
statement” in order to assign values to multiple choice responses.
Essentially, I want the exported data set to include a score based on
individual case responses. For example, for a question about level of
physical activity with responses, HIGH, MEDIUM, and LOW, I want to assign a
score of 3 to all HIGH responses, 2 to all MEDIUM responses, and 1 to all
LOW responses.

Below are two variations that I’ve tried with no success.

if(/data/physical_activity = ‘HIGH’, 3, if(/data/physical_activity =
‘MEDIUM’, 2, if(/data/physical_activity = ‘LOW’, 1, 0)))

if(/data/physical_activity = ‘HIGH’, 3) or
if(/data/physical_activity = ‘MEDIUM’, 2) or if(/data/physical_activity =
‘LOW’, 1)

Any thoughts?


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.


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.


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.


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.