Sorting choice list with integers

02-21-2021 03:25 AM
Esri Contributor

Hello all!

I have a choice list with integers and want to do a calculation based on the given number. My list looks like this. 50, 55, 60, 65 … 95, 100, 105 etc.

If the user answers e.g. 70, I want to catch all the choices from 70 and above. So I tried: if(${integerquestion} >= '70', ‘1’, ‘0’).

This works well between 70 to 95 but it doesn’t give me anything above 100. One solution is to use:
if(${integerquestion} = '70' or ${integerquestion} = '75' … ${integerquestion} = '120'

This is very ineffective and surely there is better solution out there. Does anyone have a solution for this?

0 Kudos
3 Replies
MVP Frequent Contributor

I don't use survey123 so this may not be applicable, but if the When function is available it may be easier to implement Logical Functions | ArcGIS for Developers

0 Kudos
Esteemed Contributor

If its an integer why is it in quotes.  Seems like it might be sorting based on an text field where 100 comes before 50.  That's why text fields next to be cast as a numeric field before operating on it or using another field to calculate it to be a numeric field.

0 Kudos
MVP Notable Contributor

2 ways 

if(int(${integerquestion}) >= 70, 1, 0)

or set the bind type field to int.

Hope that helps

0 Kudos