Get address/location details onto Survey123 from a web map object

1111
4
02-23-2022 09:24 PM
anne_esri
New Contributor II

Hi, 

I'm just wondering if there is a way that the location details can be passed onto my address field in Survey123 form by clicking the polygon created on my feature layer in ArcGIS online.

I can use the geopoint & pulldata function to get the location details from Survey123. However, it would be easy for the inspection officers if the address/location details can be obtained by clicking rather than entering the details in Survey123.

Any help on this would be great.

Thanks in advance

0 Kudos
4 Replies
DerrickWestoby
Occasional Contributor III

If the polygon they are clicking on contains that information in the polygon's fields, yes you can accomplish this with Arcade & URL parameters.   (Here's a link to Ismael's blog post describing the process)

1. In your web map, select the polygon layer, "configure pop-ups", and then "manage expressions"

DerrickWestoby_0-1646253270214.png

2. You'll see a window like this:

DerrickWestoby_1-1646253366101.png

Edit this Arcade Expression to suite your needs and save it:

var urlLink = 'https://survey123.arcgis.com/share/SURVEY-ITEM-ID-HERE?field:FIELDNAME1=' + $feature.Field1 + '&field:FIELDNAME2=' + $feature.Field2
return urlLink

(If you click "test" at the top of the screen, you can try it out and then copy and paste it into a new window to make sure you set it up correctly. )

3. Use the Arcade Expression that you just setup & saved in your feature's popup:

DerrickWestoby_2-1646253834694.png

 

*** If the address information you want to use is NOT stored in the polygon layer, I'm guessing you'd have to do something that's beyond my skills (and probably served by a custom Javascript web app or Experience Builder that might support something like geocoding by user click). 

0 Kudos
anne_esri
New Contributor II

Thanks for your detailed explanation. I had a look and unfortunately the address details are not stored in the polygon layer. However, I think this will be useful when it is stored.

I've got another question, I have the asset id stored in my feature layer, once the feature is selected, I need to pre-populate the asset id in the survey so I’m using the following in the popup (e.g. https://survey123.arcgis.com/share/87993679d6834df6b0fcd1d.... ?field:asset_id={AssetID}). Do I need to use the globalId to link them in the popup? I'm not sure where I should be using it.

My feature layer is separate and the survey123 data is stored separate as I used the Advanced template to create the survey not the Feature Service. Is it going to create problems later on?

Thanks

0 Kudos
DerrickWestoby
Occasional Contributor III

This is a quick reply because I'm on my phone....but I'm wondering if I misinterpreted your question. 

Are you just asking if you can geocode a polygon in S123 to store the address info in fields? If that was the question....no. but you could have a null geopoint in your survey and geocode that. 

 

And if you want the link in the pop-up to pre-fill some survey123 questions via url parameters, no you do not need a common field to join them (for it to function, at least. Its a good idea just to have one available though). 

If you want to use the link to launch a S123 form where you are editing the existing polygon feature (instead of creating a new feature), yes you would need to reference the objectid or globalid, along with enabling edit mode. 

If you want the pop-up to be updated with whatever information you're putting into the survey123 form, you would not need to create a link/join field to see the info from s123 if you set it up to edit the existing polygons. That link would have been handled when you launch the s123 form to edit. If you want to view the submitted info in the polygon pop-up and the s123 form is set up to create new features with a common join field, then yes, you'll want that available (and globalId is a good idea). 

 

0 Kudos
anne_esri
New Contributor II

Thanks. I have a better understanding of its use now.

0 Kudos