# if selected field starts with '' then other field = '', elif...?

307
1
06-25-2020 09:16 PM
New Contributor II

Possible to do a compound if statement with starts with being the second argument? e.g.

If selected veg_field starts with 'A' then surface_field = 25, elif selected veg_field starts with 'B' then surface_field = 10

Tags (4)
1 Solution

Accepted Solutions
Esri Regular Contributor

Hi Richard

You could achieve this using the starts-with() function. The following example returns a number if veg_field starts with 'A' or 'B'; else it leaves the field blank:

`if(starts-with(\${veg_field},'A'),25,if(starts-with(\${veg_field},'B'),10,''))`

For more on XLSForm functions and operators, please see: Formulas—Survey123 for ArcGIS | Documentation

Best,

Jim

Esri Regular Contributor

Hi Richard

You could achieve this using the starts-with() function. The following example returns a number if veg_field starts with 'A' or 'B'; else it leaves the field blank:

`if(starts-with(\${veg_field},'A'),25,if(starts-with(\${veg_field},'B'),10,''))`

For more on XLSForm functions and operators, please see: Formulas—Survey123 for ArcGIS | Documentation

Best,

Jim