Survey123 Tricks of the Trade: Dynamic lists (Web Designer)

3284
3
06-13-2023 06:18 PM
IsmaelChivite
Esri Notable Contributor
5 3 3,284

 

This post describes how you can use the Survey123 web designer to dynamically populate a list using an ArcGIS layer or table.  If you want to do this with Survey123 Connect, check the Dynamic Lists using Search appearance blog post from @BrettStokes 

 

About dynamic lists

 

Typically, lists are static. This is generally not a problem because many lists do not need to change: Yes/No, High/Medium/Low or a list with a well-defined collection of asset types are good examples.

Dynamic lists are those that populate on the fly from an ArcGIS layer or table. Say, for example, you want to display a list with customer names. It would make a lot of sense to populate the list from a table, since the customer database changes all the time.

Dynamic lists can load all, or some records from your table. You can apply attribute and spatial filters: Display all customers that have pending requests, all active incidents, all hospitals inside an area I will define, all available field crews within 50 kilometers from my location,  etc. 

You can visually configure dynamic lists with the Survey123 web designer. A step-by-step guide is below. If you want to learn how to do this with XLSForm, check this help topic.

 

The basics (Step-by-step guide)

 

Let's build a dynamic list in the web designer: One that loads all records from an existing layer or table. I am going to use a World Countries layer from ArcGIS Online:

  • Login into the Survey123 Web designer and create a new survey
  • Add a Dropdown question into your survey and change the label to Select a country

 

001.gif

  •  Go to the Choices section and click Edit. This will bring a panel where you can select your target layer

002.gif

  • Click Add to select the layer. Change the target source to ArcGIS Online and type World Countries in the search box. Sort items by relevance to bring the Esri authoritative layers to the top. Select the World Countries layer and click OK to confirm.

003.gif

  • Select Country Name as the choice label field. Click OK at the bottom to confirm and Preview your form. The list will populate automatically with all countries found in the layer.

004.gif

 

Attribute filters (Step-by-step guide)

 

The animation below shows what I want to do next: Add a Cities list that only shows cities within the selected country.

005.gif

  • Add a new Dropdown question type. Change the label to Select a city
  • Configure it to load records from the ArcGIS Online World Cities layer. Tip: Sort ArcGIS Online items by Relevance
  • Select the City Name label field and prepare to set the filter next.

006.gif

  • Check the Value filter.
  • We want to only show cities where the CNTRY_NAME matches the value of the Select a country question. Configure the filter as shown below. Note: If you cannot find the CNTRY_NAME filed, then you selected the wrong World Cities layer. 

IsmaelChivite_0-1686412995927.png

  • Click OK and Preview!

Spatial filters (Step-by-step guide)

 

You can also filter choices based on location. Below, you can see how I am filtering the country list so only countries within 500 kilometers from the selected location are shown. 

007.gif

I bet you can do this on your own!

  • Add a Map question to your survey
  • Edit your Select a country list to include a filter as shown below and click OK to confirm. 

IsmaelChivite_2-1686413728152.png

  •  Preview your edits to make sure they work well.

 

A few considerations, and limitations

 

I think you will agree that dynamic lists can be extremely useful. They give you a lot of flexibility to keep your lists up to date, without having to touch the design of your survey or republishing it.  Dynamic lists can feed from ArcGIS Online layers, tables and views. They also work with ArcGIS Enterprise hosted layers as well as with layers from your multiuser geodatabase.  You can use your dynamic lists in web surveys, and in the Survey123 mobile app.

Now, there are a few important things to keep in mind:

  • Dynamic lists cannot be populated while you are disconnected. We will likely address this in the future, but for now... online workflows only!
  • The total number of records loaded into the list is limited by the maxRecordCount property of the layer/table you are querying. In ArcGIS Online, the default maxRecordCount is 2,000. We are looking into how to make this better (Fix tentatively scheduled for Q4 2023), so you can work with layers and filters over the maxRecordCount limit. [Fixed August 23, 2023]
  • In the Survey123 web designer, the options we explored today to configure choices from a Layer, are ONLY available for the Dropdown question type 
  • The Dropdown list question only displays values when you activate the control or start typing in it.  Only choices that match what you type will be displayed
  • The Survey123 web designer will only load unique values from your layer.  That is, you will not see duplicate labels.

I hope this is useful. Thanks for reading all the way to the bottom!

 

 

3 Comments