I have a web app in which a geocoding service is used. An address is searched, selected, and the associated polygon’s pop-up appears with a link to a survey. I would like the address to prepopulate the survey in a text field, as well as the geopoint to auto-zoom to that address as well. I don’t know how to pass data to a survey that does not already exist in a feature layer. Thanks for your help!
Hi @Elizabeth_Burniston,
Have you looked into passing the address text and geopoint coordinates with URL parameters?
The Parameters for the web app section of the Survey123 documentation and this blog have more details.
- Barbara
Thanks @BarbaraWebster1 - I have used URL parameters in the past and considered this here, but how do I pass data from a geocoding service to the S123 feature layer? I am not using an existing feature layer with the address text and coordinates already populated. Further, the 'center' parameter requires a known coordinate to be entered. What would be the syntax for coordinates that change for each new survey?
Hi @Elizabeth_Burniston,
If you were accessing the survey link in a feature layer pop-up you could use Arcade to calculate the coordinates and construct the survey URL. Perhaps you can try a similar approach for your survey link?
Also, Survey123 supports geocode services, another possible approach would be for the user to search for the address from the survey instead of the map.
- Barbara
Thanks again @BarbaraWebster1 - I'm not accomplished with Arcade by any means, but I will use what you provided as a template to see what I can do. Meanwhile, it is an information lookup app, so searching for an address is required. If their address falls in a certain area, then they are led to the survey. While it may be redundant, they can certainly enter their address again (text field - geoshape appearance) and ideally, I can put in the calculation to auto-zoom the map where they are to digitize their own polygon. So, I did just that but the map did not auto-zoom. I did some research and it seems this has been a bug over the years?
@Elizabeth_Burniston Calculations and defaults would attempt to populate the geoshape geometry, so it would be expected that passing point coordinates to a geoshape question wouldn't do anything. The center URL parameter would be the best approach to centering the map dynamically.
I rigged up Experience Builder as follows:
There is a glitch though. I have a geocode question in my survey which takes the address (passed in from the selected feature), runs a geocode, returns the XY and centers the new survey point. However, as the address is technically PRE-populated before the survey is even created the geocoder fails to fire. Manually editing the address, even to just remove a single address number and replace with identical, then causes the geocoder question to wake up, fire and return the XY centering the survey point. Additionally I can trigger if off any other question which is NOT pre-populated.
There is a recalculate URL parameter that I’m using to try to get the geocoder question to fire after the survey is created but it dens't seme to work. I'm using the syntax:
“&recalculate=field: ADDRESS_HOLDER”
If anyone can offer some advice on how to get the geocoder question to fire with PRE-populated values I would appreciate it.