If then calculation for Survey 123 with edit URL parameters

162
2
Jump to solution
01-07-2022 11:43 AM
BurnistonElizabeth
New Contributor II

I need help with an if/then calculation in a survey used with edit url parameters. The ${STREET} field is already populated and the ${ST_ANSWER} field is a single choice option. The user selects the feature on the map, then chooses their ST_ANSWER from the dropdown menu. If the selection is equal to the STREET already populated for that record, then I want the result to be 1, if not, then 0. The below is one of many I've attempted, but closest to what I thought would work. Any assistance is appreciated! Thanks!

if(selected(${ST_ANSWER}=${STREET}),'1','0')

 

0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Notable Contributor

If it is text can skip the selected part so just this.  ( not sure why you want a text based '1' vs 1?)

if${ST_ANSWER}=${STREET},'1','0')

For selected it would be

if(selected(${ST_ANSWER}, ${STREET}),'1','0')

Hope that helps

View solution in original post

0 Kudos
2 Replies
DougBrowning
MVP Notable Contributor

If it is text can skip the selected part so just this.  ( not sure why you want a text based '1' vs 1?)

if${ST_ANSWER}=${STREET},'1','0')

For selected it would be

if(selected(${ST_ANSWER}, ${STREET}),'1','0')

Hope that helps

0 Kudos
BurnistonElizabeth
New Contributor II

The first option works perfect! And I removed the quotes - I thought they were needed in the syntax. Thanks for pointing it out. Thank you for your quick help - I appreciate it!

0 Kudos