Select to view content in your preferred language

Auto-populate a survey answer based on a layer

07-17-2023 10:44 AM
Labels (1)
by Esri Regular Contributor
Esri Regular Contributor
5 0 964

Sometimes there is information on the map that you’d like to capture with your survey result. In this example, students are capturing water quality samples along the river, and you've divided the river into zones. In the survey, have the map provide the zone as an answer in the survey instead of having students enter it. 


While students could fill out the zone, there is no need for them to and it can introduce human error. You could get a sample that says it was taken in Zone 03, but the point on the map is in Zone 05. Which is correct – the point or the zone? Avoid this type of error by reading the zone from the map directly into your survey.

To read the zone from a layer and put it into a question, add a question to record the zone and configure it to use a calculation based on the map. Watch the video below or follow the text steps below the video to configure this behavior in a survey:

  1. Add the question where you'll capture the information from the map as the answer. Think about the type it should be – are you reading a number from the map? A string? In this example, the zone names are strings so I used a Singleline text question.
  2. As you configure the question, give it a title (like "What zone was the sample collected in?").
  3. Click Edit beside Calculation – this allows you to specify how the answer is populated and and to have it update whenever relevant information in the survey is changed.
  4. In the Edit calculation panel, for Source select Layer.
  5. Beside Select layer or table click Add.
  6. Browse to and select the layer with the information to use to populate the question and click OK.
    This could be a layer you found with the info (states, counties, watersheds, etc.). Or it could be a layer you created, as it is in my example.

    If you are creating the layer like I did for this water quality zone example, you have choices about how to create it, including (1) Creating a survey in Survey123 to create that layer as well, making sure to share the results publicly and use the results layer in your map, or (2) Defining your own layer in ArcGIS Online. The first choice is recommended if you haven't created layers in ArcGIS Online before. 
  7. Below Select output field choose the name of the field that will populate the survey.
  8. For Set filter, enable Extract data by location and select the map in your survey. This means the location set on the map will be used to find the data from the layer.
  9. Click OK to complete configuration of the question.

Note: In the video, the sample zones are also included in the map. This is so that students can see them as they work, but that isn’t required to do a calculation. The layer used in the calculation doesn’t have to be part of the map. If you do want the layer in the map of the survey, using a custom map is discussed in See results while collecting data in Survey123. (That shows using a map with the survey data included in it, but you can use similar steps to use any map in your survey.)

Think about where you might want to pull data from the map and save it as a part of a survey. Do you need to include the city and county that people are in? Are you working in different eco-regions or forest types? Put Survey123 to work for you – require less data entry and improve your data quality.

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.