if Statement for Map Questions in Survey 123 Connect

157
3
Jump to solution
2 weeks ago
MonmouthNJGIS
New Contributor II

Howdy! My organization is attempting to have a geopoint question automatically center on a specified location based on a previous answer. Our research led us to using an if statement and having the coordinates entered in the following syntax: concat('40.293474497282965', ' ', '-74.30371444582654')

We came up with the following if statement but it keeps returning the following error:

Error: ...cannot handle function 'if' requires arguments. Only 4 provided...

 

Statement: if(${do_members_of_your_household_us}, 'Headquarters_Manalapan', concat('40.293474497282965', ' ', '-74.30371444582654'), if(${do_members_of_your_household_us}, 'Eastern_Branch_Shrewsbury', concat('40.318380142105774', ' ', '-74.06151036074922'), concat('40.265', ' ', '-74.251')))

0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Esteemed Contributor

you do not have any = or selected at all.

Try this

if(${do_members_of_your_household_us} = 'Headquarters_Manalapan', concat('40.293474497282965', ' ', '-74.30371444582654'), if(${do_members_of_your_household_us} = 'Eastern_Branch_Shrewsbury', concat('40.318380142105774', ' ', '-74.06151036074922'), concat('40.265', ' ', '-74.251')))

View solution in original post

3 Replies
DougBrowning
MVP Esteemed Contributor

you do not have any = or selected at all.

Try this

if(${do_members_of_your_household_us} = 'Headquarters_Manalapan', concat('40.293474497282965', ' ', '-74.30371444582654'), if(${do_members_of_your_household_us} = 'Eastern_Branch_Shrewsbury', concat('40.318380142105774', ' ', '-74.06151036074922'), concat('40.265', ' ', '-74.251')))

MonmouthNJGIS
New Contributor II

Thanks! we got some conflicting examples that did and didn't use an "=". This is the final statement we came up with:

if(${do_members_of_your_household_us} = 'Headquarters_Manalapan', "40.293474497282965 -74.30371444582654",
if(${do_members_of_your_household_us} = 'Eastern_Branch_Shrewsbury', "40.318380142105774 -74.06151036074922",
"40.265 -74.251"))

0 Kudos
DougBrowning
MVP Esteemed Contributor

You probably saw examples use selected.  Works the same in select one but if this was a select multiple then you would have to use it.

selected(question, value)

Checks whether answer is selected. This function is used for select_one and select_multiple questions.

selected(${question_one}, 'a')

 

Would look like 

if(selected(${do_members_of_your_household_us},'Headquarters_Manalapan'), "40.293474497282965 -74.30371444582654",
if(selected((${do_members_of_your_household_us},'Eastern_Branch_Shrewsbury'), "40.318380142105774 -74.06151036074922",
"40.265 -74.251"))

0 Kudos