Survey123 If And statement

09-29-2020 03:56 PM
New Contributor


I am struggling with the if and statement for the calculation field... not sure if that is what it is called. 

this is my choice list, I need to populate a RiskLevel field based on the choices from the table below

like if VARMAGNITUDE=Minor and VARRISKPRELIM=Unlikely RiskLevel=Very Low

or if VARMAGNITUDE=Major and VARRISKPRELIM=VeryLikely  RiskLevel=Very High 

... there are 12 potential outputs.

Choice sheet

Risk Level

Tags (1)
0 Kudos
2 Replies
Esri Regular Contributor

Hello CA SC - Mark Schug (GISS)‌, 

There are a couple ways you can go about this, one option that I was testing was to nest all the if() statements. 

For example this is a statement that does all of the combinations in the Major magnitude of consequences column: 

if(selected(${mag}, 'major') and selected(${risk}, 'vlikely'), 'Very High', if(selected(${mag}, 'major') and selected(${risk}, 'likely'), 'Very High', if(selected(${mag}, 'major') and selected(${risk}, 'possible'), 'High',if(selected(${mag}, 'major') and selected(${risk}, 'unlikely'), 'Intermediate',''))))

Where the last single quotes are in the statement is where the expression can continue to add the rest of the combinations. 

Another option would be to split them into their own calculate question and then at the end do something like: 

${cal} or ${cal2} or ${cal3} etc. 

Please use this link for reference regarding the if() function in ArcGIS Survey123.

Thank you, 


Thank you,
New Contributor

The first option worked great! Exactly what I was looking for! 

Thank you for the reply!

0 Kudos