HOW TO
When creating a survey, some responses require specific formatting or spelling. For instance, when spelling out a complex drug's name such as Levetiracetam, or when entering a ZIP code, the spelling and format must be accurate to avoid inconsistencies and misinterpreting data. Setting some constraints or conditions to these questions controls the format and spelling of the responses.
This article provides three methods to ensure consistent formatting and spelling for responses by setting constraints or conditions in the ArcGIS Survey123 questions.
Set the appearance to autocomplete
Autocomplete can be used for questions that have a list of answers to choose from, such as a list of students in a class, country names, and months in a year. Setting the select_one question appearance to autocomplete narrows the options when the first few letters of the word are typed. Spelling inconsistencies can be avoided when choosing the answer from the list.
Note: The autocomplete option is only available for the select_one question type with a list of answers on the choices sheet. Refer to the Appearance worksheet of the XLSForm, or ArcGIS Survey123: Appearances for more information on the appearance and the question type.
In the survey, the options from the drop-down list are narrowed down to display only a few drugs' names containing the letters LE.
Use the regex() function
The regex() function controls how the responses must be entered. When using the function, the responses must follow the format defined by the function before submitting the survey. This function can be used for text, integer, or decimal question types. Refer to ArcGIS Survey123: Regular expressions for more information.
regex(.,'<word>')
regex(.,'^\d {<digit>}&')
In this example, regex(.,'Street) is typed to ensure the word 'Street' is typed in the response. A word such as 'streets' prevents the submission of the survey. The regex (., ‘^\d {5} $’) expression is used for the integer question type, allowing only five-digit numbers in the response.
Note: Refer to the Reference worksheet of the XLSForm under the Regular Expressions section for a list of regular expressions that are available in ArcGIS Survey123 Connect.
In the survey, the "Invalid" error message is returned when the responses do not contain the word 'Street', or a five-digit number in the respective questions.
Set the appearance to predictivetext
Set the appearance to predictivetext to enable predictive text when responding to the questions in the ArcGIS Survey123 application for mobile devices. Refer to ArcGIS Survey123: Text for more information on predicitve text.
Note: Predictivetext and nopredictivetext appearances are not supported in the ArcGIS Survey123 web app. Refer to ArcGIS Survey123: Question types for more information on XLSForm features that can be used in ArcGIS Survey123 applications.
In this example, predictivetext and nopredictivetext are selected in the appearance column of the questions.
In the published survey, the predictive text is displayed for the question with a predictivetext appearance (image on the left) and not displayed for the question with a nopredictivetext appearance (image on the right) on an Android device.
Get help from ArcGIS experts
Download the Esri Support App