Select to view content in your preferred language

Fill in field based on answer in previous field

937
2
Jump to solution
02-15-2023 04:30 PM
VickiG
by
Regular Contributor

Hello:  Relatively new Survey123 Connect User here.  First I want to say Thank You to this very helpful community.  You have answered so many questions for me already.  Hooray for bind::esri:fieldAlias, this saved me lots of frustration! 🙂

I am recreating an existing form for wildlife survey data collection.  We have a long term dataset and need to update the tech on the collection end.  

I have read many posts on how to populate a field based on the answer to a previous field and have tried several things.  What I want to do seems pretty simple, but I am not figuring it out.  

Basically the question is, did the animal you observe have marks (ear tags, radio collar)?  If the answer to field 'Marks' is None, I want to populate the following fields, left ear color, left ear shape, etc with None.

See the screen shot of what I have tried in the Relevant column.  I also put this expression in the calculation field.  But thus far, no luck.

Am I on the right track?  

Thank You

 

0 Kudos
2 Solutions

Accepted Solutions
Katie_Clark
MVP Alum

Hi, I think this should work for you. It needs to be in the calculation column, not the relevant column.

if(${Marks} = 'None', 'None', '')

When using if statements, you need to provide the else condition as well (the third argument). In this case, it's just empty quotes so nothing happens if ${Marks} isn't 'None'.

Also, keep in mind that your expression needs to use the name of the choice, not the label. 

Best,
Katie


“The goal is not simply to ‘work hard, play hard.’ The goal is to make our work and our play indistinguishable.”
- Simon Sinek

View solution in original post

VickiG
by
Regular Contributor

Hi Katherine:

That worked, I moved to calculations column and removed any extraneous spaces.

Thanks so much!

 

View solution in original post

0 Kudos
2 Replies
Katie_Clark
MVP Alum

Hi, I think this should work for you. It needs to be in the calculation column, not the relevant column.

if(${Marks} = 'None', 'None', '')

When using if statements, you need to provide the else condition as well (the third argument). In this case, it's just empty quotes so nothing happens if ${Marks} isn't 'None'.

Also, keep in mind that your expression needs to use the name of the choice, not the label. 

Best,
Katie


“The goal is not simply to ‘work hard, play hard.’ The goal is to make our work and our play indistinguishable.”
- Simon Sinek
VickiG
by
Regular Contributor

Hi Katherine:

That worked, I moved to calculations column and removed any extraneous spaces.

Thanks so much!

 

0 Kudos