How To: Query another feature layer to return attributes based on the location of a geopoint question
- Log in to ArcGIS Survey123 Connect.
- Create a new survey, and select the Samples option.
- Click XLSForm and modify the questions. Delete the unnecessary examples except for the Working with a Feature Service example.
- In the hidden field type for adminURL, replace the URL in the default column to the preferred layer.
Note: Make sure the URL is redirecting to the layer within the feature service.
Modify the functions in the calculation columns for the rest of the fields accordingly for the queries to return the desired results. Refer to ArcGIS Survey123 Blog: Extending Survey123 smart forms with custom JS functions for more information.
The image below shows the example of the featureByLocation function is used in adminFeature, and the fieldValueByLocation function is used in adminName.
Note: The featureByLocation function is used to return the JSON object of the polygon feature with which the point from the geopoint question intersects. The JSON object may then be further processed to extract specific attributes. The fieldValueByLocation function is used to return a specific attribute from the field. Refer to ArcGIS Survey123: Known limitations for more information.
- Save the changes, and publish the survey form.
The image below shows the example of the query results.
- ArcGIS Survey123: Geopoints
- ArcGIS REST APIs: Query (Feature Service/Layer)
- ArcGIS Survey123 Blog: Pulling data from geopoint questions
- ArcGIS Survey123 Blog: Survey123 Tricks of the Trade: Lines and Polygons
Last Published: 6/10/2021
Article ID: 000025459
Software: ArcGIS Survey123 3.9, 3.8, 3.7, 3.6, 3.5, 3.4, 3.3, 3.2, 3.12, 3.11, 3.10, 3.1, 3.0, 2.9.Classic, 2.8 ArcGIS Online 9.1