Using Survey123 multiple select data in a dashboard

1022
2
11-06-2023 09:14 AM
Kylie
by Esri Regular Contributor
Esri Regular Contributor
5 2 1,022

You want to ask a question with multiple answers. In Survey123, you can use a multiple select question. However, the data it creates needs to be processed before it is used. This blog looks at the data and how to process it for use.

We also look at the alternate option of using a single select grid question, which collects similar data without the processing requirement.

Survey123 allows you to ask multiple select questions, where the person can choose any number of the answer choices. For example, think about questions where, when presented with a list of choices, the same person can have multiple choices that are correct.

Kylie_0-1699288704377.png

  • What subjects do you like?
  • Which of these medicines are you allergic to?
  • Which of these places have you visited?
  • What kind of books do you like to read?

However, in Survey123, multiple select questions record the answer as a string. Specifically, a comma-delimited string where each choice is listed and separated by a comma from the next choice. If you look at these anywhere other than Survey123, you’ll see either:

  1. Single answers as a short string
    For example, "Social_studies"
  2. Answers where multiple options were chosen as long, mashed up strings
    For example, "Science,Math,Social_studies,Other"

Kylie_1-1699288704379.png

Let’s say you like both English and Social Studies, and select those two answers. Your answer would be recorded as "English,Social_studies" or perhaps "Social_studies,English" – and yes, since we are looking at strings, those are different. This makes the data tough to use in a dashboard.

Spoiler alert! You’ll need to do some processing on this data to use it as you likely expect to. (That’s what most of the blog is going to show you.)

________

Is there a way to avoid processing the data?

Of course, you can just use the string answer as it is. But be aware that some answers you might consider the same will be used separately. You’ll get charts like this:

Kylie_2-1699288704380.png

Notice that "English,Social_studies" is considered a different answer than "Social_studies,English" – the order the choices are listed impacts if they are considered the same answer.

A better way to avoid processing the data is to avoid multiple select questions – and in fact, I recommend that to people new to Survey123 and dashboards. Instead, ask about each subject separately. A recommendation for doing so is to use a single select grid. Ask your question, like "What subjects do you like?" and have a row for each subject in the grid. The reader does have to answer each row, but each answer is stored in its own field.

singleSelectGrid-withQuestion.png

_________

How do I process the data if I use a multiple select question?

Once you have some confidence working with data and are prepared to process the data before using it, multiple select questions and dashboards can work together. You just need to put in a little extra work and think about how you want to use the data. Two common ways it is used it to answer questions like the following:

  1. Who gave the same set of answers (for example, picking A, B, and D, but not C or E)?
    Kylie_4-1699288704382.png

     

  2. Who gave a particular answer at all (for example, did they pick A)?
    Kylie_5-1699288704383.png

     

There are a couple of ways to see the answer to either of these in a dashboard. The trick is doing some processing of the data, either with data expressions or by processing it when it’s submitted.

Option 1: Process the data with data expressions
ArcGIS Dashboards have a functionality called "data expressions" – these take data and process it through ArcGIS Arcade into a new dataset that can be used in the dashboard. Data expressions are useful for answering both questions A and B – who gave an answer at all, and who made the same set of choices.

Kylie_6-1699288704384.png

Caption: Snippet of the data expression code for looking at subjects

Data expressions are an advanced technique – they are written in ArcGIS Arcade and require programming ability (or at least the ability to find an example and edit it). In addition, when using data expressions, you work with a FeatureSet in the Dashboard. Think of the feature set as a new set of data – it doesn’t know the full details of your original data. As such, you lose the connection to the exact datapoint on the map. You can see that, for example, 60% of people choose English and Social studies. But you can’t use that information to filter the map and see where those people are.  

To use a data expression to parse a multiselect answer, see the data expression example Split comma separated values across multiple rows.

Option 2: Process the data on submission and populate additional fields

You can present the user with a multi-choice question, and then behind the scenes change what is stored to an attribute per answer. For example, you can alphabetize the choices in the string so that the same answer sets generate the same strings, or you can store the answer to each choice as a yes/no.

Kylie_7-1699288704386.png

There are a few ways you can edit your layer to have additional information also included in it:

  1. Using a notebook in ArcGIS (example notebook)
  2. Through a webhook that parses the data and updates the layer (using Microsoft Power Automate or Make.com)
  3. With calculations in the survey itself (requires Survey123 Connect; see “Controlling how user selections are stored in ArcGIS” in the blog Understanding Multiple-Choice Questions in Survey123 for ArcGIS)

This results in growing the size of your database – for example, you might add a column for each choice in the multiselect to make it easier to see who picked which answers. Have 3 options? That’s 3 more columns. Have 12? That’s 12 more columns. And if you have multiple multiselect questions, you can see how this can quickly grow. (However, it will be the same number of columns you would have if you chose to use a single select grid instead of a multiple select question.)

Unlike data expressions, since you keep the details of the answer tied to the same feature, you retain the connection between the feature and the answer. Since the processed answers are just part of the data, you can even symbolize on the added fields.

Kylie_8-1699288704389.png

 

Example

Here’s at an example survey and a dashboard of the data collected by the survey. Add your answers, see how the data change and what you can and can’t see and do with the raw data, data expressions, and processed data.

Note: This is not an example demonstrating best practices for a dashboard. Instead, it is an example showing possibilities for working with this type of data.

Want to see how we made the dashboard? Remember you can copy a dashboard and then modify your copy to see how it was configured.  

2 Comments
JenniferAcunto
Esri Regular Contributor

I think one of the most important skills you need to be successful with Survey123 is the ability to plan ahead. Thinking about what you want to do with the data once you have collected it, and how you want to display it, and then using that information to help guide your survey design is so important. It's also something that a lot of us have had to learn the hard way. 

Kylie
by Esri Regular Contributor
Esri Regular Contributor

For sure! That's one of the key points we focus on with educators whenever we introduce Survey123 as a tool, or talk about data collection.

About the Author
Our kids need GIS in their problem-solving toolboxes. I'm working to get digital maps into each K-12 classroom and the hands of each child. A long-time Esri employee, I've previously worked on Esri's mobile apps, focused on documentation and best practices. Out of the office I'm a runner often found on the trails or chasing my children.