Using null or not null values in a field to set a default select_one choice in Survey 123 Connect

1651
2
Jump to solution
01-26-2023 06:59 AM
JoeDahlen
New Contributor

Upon loading a survey, I am trying to make an answer for a select_one question default to either 'new' or 'existing' based on whether or not another value in my table is null or not null. What would be the code for this, and would it be entered in the default or calculation column? Can this be done with an if/then statement?

Am I at least in the ballpark with this or is there an easier way?
if(${Location} = null),select_one = 'new') or if(${Location} = notnull),select_one = 'existing')

Thanks!

0 Kudos
1 Solution

Accepted Solutions
Richard_Purkis
Esri Contributor

Hi @JoeDahlen 

I think something like this should work for you:

  • if((string-length(${Location})>0),'existing','new')

Place this in your calculation field

Hope this helps

View solution in original post

2 Replies
Richard_Purkis
Esri Contributor

Hi @JoeDahlen 

I think something like this should work for you:

  • if((string-length(${Location})>0),'existing','new')

Place this in your calculation field

Hope this helps

JoeDahlen
New Contributor

Thank you @Richard_Purkis!

Formula worked great. The only thing I had to add was under bind::esri:parameters, calculationMode=always