Survey123 calculate field

1682
2
Jump to solution
02-22-2018 07:24 AM
MelissaMann1
New Contributor

I have a collector app with a custom url (including an ID field) to open Survey123. The url opens the survey and the ID field is populated in my survey. I want to do a calculation on the ID field. Specifically, if the ID field contains a sub-string of 'xyz', I want to use the sub-string to reveal a group. I keep getting an error when I save the exel forms, is there a way around this?

Reply
0 Kudos
1 Solution

Accepted Solutions
JamesTedrick
Esri Esteemed Contributor

Hi Melissa,

This is possible - you would need to have a calculation in the relevant column of the group that will hide/show based on the ID value.  For a substring, you will want to use a regex function (see the Regular Expressions section of Formulas—Survey123 for ArcGIS | ArcGIS ); it will likely be something like

regex(${id_question}, '^.*xyz.*$')

View solution in original post

Reply
0 Kudos
2 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Melissa,

This is possible - you would need to have a calculation in the relevant column of the group that will hide/show based on the ID value.  For a substring, you will want to use a regex function (see the Regular Expressions section of Formulas—Survey123 for ArcGIS | ArcGIS ); it will likely be something like

regex(${id_question}, '^.*xyz.*$')

View solution in original post

Reply
0 Kudos
MelissaMann1
New Contributor

Thanks James! Yes that worked. I was trying to do a sub-string calculation like this: substr(${id},5 ,3), in the calculation field, then in the group relevant field use if ${calculation_field}="xyz". Your suggestion worked right away. Thank you. 

Reply
0 Kudos