Survey123 is a very popular ArcGIS App for the Field and I’m always looking for new ways to work with it – to make sure it’s delivering value for my users. Previously I’ve looked at applying a custom Other field and in this blog I investigate making survey results easier to analyse, or symbolise, when a survey includes the Other functionality.
If you’re not aware, the Other functionality allows users to enter an Other value as an answer to a multiple choice question, if the answer they need is not in the list. This has been implemented for the question What is the property type?:
This functionality is awesome, but the Other value that a user inputs is assigned to a new field in the attribute table. This means it can be hard to analyse and query this question later on because the answers for one question are spread over two fields:
Here’s a method to collate these answers to one field, making it easier for end users to view and query the data. So instead of the answers looking like the above example, they will look like this:
If you need some help setting up a Survey123 survey, check out the help videos and pages. This blog assumes you have a survey set up using the Survey123 Connect for ArcGIS desktop application with at least one select_one type question.
The blog is split into 2 sections to cover different methods used to implement Other
- If you are using the or_other method, look at Section 1.
- If you are manually adding Other as a choice option, look at Section 2
- If you are working with choice names that include spaces, step 5 in Section 2 covers this.
Please note: the methods described below will only work in the Survey123 survey. If you edit the data in the ArcGIS Online map viewer or in Collector for ArcGIS, the changes won’t automatically be reflected.
Section 1
1) Browse to the select_one question you have set up with or_other:
In the background, Survey123 creates a new field to hold the Other value entered by the end user. The name of this field is usually the name of the select_one field followed by ‘_other’. In the example above, the new field created for the is called PropertyType_other (you can also find this field name by looking in the Schema Preview in the Survey123 Connect for ArcGIS desktop application).
2) Create a new text question under the select_one question (this is for testing, later this field will be of type hidden). Name and label it something like this:
3) Now you need to create an if statement to determine what value is written to this new field. This if statement will be entered into the calculation field. The if statement for this survey will be:
if(${PropertyType}='other', ${PropertyType_other}, ${PropertyType})
It’s important that ‘other’ is all lowercase as this is what Survey123 will recognise in this case.
In simple terms: if the PropertyType question answer is ‘other’, then assign the PropertyType_other value to this field. Otherwise assign the PropertyType value to this field.
The survey will look like this:
4) Save the Excel spreadsheet and preview the functionality in Survey123 Connect:
5) When you’re happy with the survey, head back to Excel and change the type of question to hidden for PropertyTypeCollated:
This means that this question will be hidden from end users in the Survey123 app, but will be available for you later on. So you can display it in a pop up or use it as a field for analysis/querying.
**Hidden fields are not currently supported in the Survey123 website (http://survey123.arcgis.com) but has been added as an enhancement request.
6) Your survey is now ready to be published and used on a mobile device.
Section 2
1) Browse to the select_one question you have set up with Other as a choice option:
2) Create a new text question under the select_one question. This will be the text field to hold the Other – SurveyType answer. Name and label it something like this:
3) Now you need to create an if statement to determine what value is written to this new field. This if statement will be entered into the calculation field. The if statement for this survey will be:
if(${SurveyType}='Other', ${SurveyTypeOther}, ${SurveyType})
This Other is looking at the name column in the choice list.
In simple terms: if the SurveyType question answer is ‘Other’, then assign the SurveyTypeOther value to this field. Otherwise assign the SurveyType value to this field.
The survey will look like this:
4) Save the Excel spreadsheet and preview the functionality in Survey123 Connect:
5) You may notice above that if you choose Health and Safety as the answer, the SurveyTypeCollated field has the text HealthandSafety. This is because Survey123 pulls the text from the name column and not the label column:
We can expand the current if statement to compensate for choices that include spaces/characters by nesting the if statements:
if(${SurveyType}='HealthandSafety', 'Health and Safety', if(${SurveyType}='Other', ${SurveyTypeOther}, ${SurveyType}))
In simple terms: if the SurveyType question answer is ‘HealthandSafety’, then assign ‘Health and Safety’ to this field, if the SurveyType question answer is ‘Other’, then assign the SurveyTypeOther value to this field. Otherwise assign the SurveyType value to this field.
More information about nested if statements can be found here but please note that Survey123 does not need the statements to begin with ‘=’.
6) Save the Excel spreadsheet and preview the functionality in Survey123 Connect.
7) When you’re happy with the survey, head back to Excel and change the type of question to hidden for SurveyTypeCollated:
This means that this question will be hidden from end users in the Survey123 app but will be available for you later on. so you can display it in a pop up or use it as a field for analysis/querying.
**Hidden fields are not currently supported in the Survey123 website (http://survey123.arcgis.com) but has been added as an enhancement request.
8) Your survey is now ready to be published and used on a mobile device.
Collating answers to one field will make creating queries, filters, applying symbology and running analysis easier!