Is it possible to use multiple IF statements to assign more than 2 values
to a hidden value property, like in Excel? I have a multiple choice
question with 4 possible responses. In Excel, I would write the following
formula:
IF(Q1=1,"A1",IF(Q1=2,"A2",IF(Q1=3,"A3","A4")))
Is this possible in CommCare? I'd also be interested in doing this with a
checkbox question.
Clarification: this seems to work fine with 3 IF statements, but not any
more. Is there a limit to the number of IF statements CommCare will accept?
···
On Tuesday, August 23, 2016 at 2:51:40 PM UTC+2, Eric Jospe wrote:
>
> Is it possible to use multiple IF statements to assign more than 2 values
> to a hidden value property, like in Excel? I have a multiple choice
> question with 4 possible responses. In Excel, I would write the following
> formula:
>
> IF(Q1=1,"A1",IF(Q1=2,"A2",IF(Q1=3,"A3","A4")))
>
> Is this possible in CommCare? I'd also be interested in doing this with a
> checkbox question.
>
>
There is no limit I am aware of - what error are you running into? When
troubleshooting complex if statements I sometimes use a text editor like
Notepad ++ or Sublime Text so I can more easily see if there is an issue
with matching parentheses.
Jeremy
···
On Tue, Aug 23, 2016 at 7:03 PM, Eric Jospe wrote:
Clarification: this seems to work fine with 3 IF statements, but not any
more. Is there a limit to the number of IF statements CommCare will accept?
On Tuesday, August 23, 2016 at 2:51:40 PM UTC+2, Eric Jospe wrote:
Is it possible to use multiple IF statements to assign more than 2 values
to a hidden value property, like in Excel? I have a multiple choice
question with 4 possible responses. In Excel, I would write the following
formula:
IF(Q1=1,"A1",IF(Q1=2,"A2",IF(Q1=3,"A3","A4")))
Is this possible in CommCare? I'd also be interested in doing this with a
checkbox question.
Validation Error: Problem with bind for /data/A/land_problems_case
contains invalid calculate expression [if(/data/A/Land_problems_explained =
'Too_small', "Ubutaka ni buto cyane", if(/data/A/Land_problems_explained =
'Stones', "Ubutaka bwuzuye amabuye/amakoro cyangwa ntibwera",
if(/data/A/Land_problems_explained = 'Far', "Ubutaka burengerwa n'amazi",
"Ubutaka buri kure y'urugo", "Ibindi")))] if() function requires 3
arguments but 4 are present. in form Baseline / Home Visit 1 https://www.commcarehq.org/a/gardens-for-health/apps/view/2b6a814be0d3904b8f7c4d059bb26b3c/modules-2/forms-0/
in
module "Baseline & Home Visits"
-Eric
···
On Tue, Aug 23, 2016 at 3:38 PM, Jeremy W. wrote:
Hi Eric,
There is no limit I am aware of - what error are you running into? When
troubleshooting complex if statements I sometimes use a text editor like
Notepad ++ or Sublime Text so I can more easily see if there is an issue
with matching parentheses.
Clarification: this seems to work fine with 3 IF statements, but not any
more. Is there a limit to the number of IF statements CommCare will accept?
On Tuesday, August 23, 2016 at 2:51:40 PM UTC+2, Eric Jospe wrote:
Is it possible to use multiple IF statements to assign more than 2
values to a hidden value property, like in Excel? I have a multiple choice
question with 4 possible responses. In Excel, I would write the following
formula:
IF(Q1=1,"A1",IF(Q1=2,"A2",IF(Q1=3,"A3","A4")))
Is this possible in CommCare? I'd also be interested in doing this with
a checkbox question.
If you want to include "Ibindi" as an alternative you would need another if
statement to distinguish between that and the prior value.
Jeremy
···
On Tue, Aug 23, 2016 at 7:44 PM, Eric Jospe wrote:
Hey Jeremy, here's the error message I'm getting:
Build Failed!
Validation Error: Problem with bind for /data/A/land_problems_case
contains invalid calculate expression [if(/data/A/Land_problems_explained
= 'Too_small', "Ubutaka ni buto cyane", if(/data/A/Land_problems_explained
= 'Stones', "Ubutaka bwuzuye amabuye/amakoro cyangwa ntibwera",
if(/data/A/Land_problems_explained = 'Far', "Ubutaka burengerwa
n'amazi", "Ubutaka buri kure y'urugo", "Ibindi")))] if() function requires
3 arguments but 4 are present. in form Baseline / Home Visit 1 https://www.commcarehq.org/a/gardens-for-health/apps/view/2b6a814be0d3904b8f7c4d059bb26b3c/modules-2/forms-0/ in
module "Baseline & Home Visits"
There is no limit I am aware of - what error are you running into? When
troubleshooting complex if statements I sometimes use a text editor like
Notepad ++ or Sublime Text so I can more easily see if there is an issue
with matching parentheses.
Clarification: this seems to work fine with 3 IF statements, but not any
more. Is there a limit to the number of IF statements CommCare will accept?
On Tuesday, August 23, 2016 at 2:51:40 PM UTC+2, Eric Jospe wrote:
Is it possible to use multiple IF statements to assign more than 2
values to a hidden value property, like in Excel? I have a multiple choice
question with 4 possible responses. In Excel, I would write the following
formula:
IF(Q1=1,"A1",IF(Q1=2,"A2",IF(Q1=3,"A3","A4")))
Is this possible in CommCare? I'd also be interested in doing this with
a checkbox question.
Validation Error: Problem with bind for /data/A/land_problems_case
contains invalid calculate expression [if(/data/A/Land_problems_explained
= 'Too_small', "Ubutaka ni buto cyane", if(/data/A/Land_problems_explained
= 'Stones', "Ubutaka bwuzuye amabuye/amakoro cyangwa ntibwera",
if(/data/A/Land_problems_explained = 'Far', "Ubutaka burengerwa
n'amazi", "Ubutaka buri kure y'urugo", "Ibindi")))] if() function requires
3 arguments but 4 are present. in form Baseline / Home Visit 1 https://www.commcarehq.org/a/gardens-for-health/apps/view/2b6a814be0d3904b8f7c4d059bb26b3c/modules-2/forms-0/ in
module "Baseline & Home Visits"
There is no limit I am aware of - what error are you running into? When
troubleshooting complex if statements I sometimes use a text editor like
Notepad ++ or Sublime Text so I can more easily see if there is an issue
with matching parentheses.
Clarification: this seems to work fine with 3 IF statements, but not
any more. Is there a limit to the number of IF statements CommCare will
accept?
On Tuesday, August 23, 2016 at 2:51:40 PM UTC+2, Eric Jospe wrote:
Is it possible to use multiple IF statements to assign more than 2
values to a hidden value property, like in Excel? I have a multiple choice
question with 4 possible responses. In Excel, I would write the following
formula:
IF(Q1=1,"A1",IF(Q1=2,"A2",IF(Q1=3,"A3","A4")))
Is this possible in CommCare? I'd also be interested in doing this
with a checkbox question.