Select to view content in your preferred language

Format for passing values via Attribute Expressions from Collector to Survey123

3972
10
Jump to solution
04-27-2018 09:29 AM
JosephDrahos
Emerging Contributor

I have seen some great questions, answers and discussions posted at a few other locations here on GeoNet, but I still have a lingering issue that I am trying to resolve. As a bit of background, I am utilizing the Collector app with prepositioned locations, then using the Collector pop-up to pass values of a particular point into a related Survey123 record. I am currently using two fields stop_lat and stop_lon that have the coordinates (in decimal degrees) and passing these onto the Survey123 app. These fields were populated using the 'Calculate Geometry' tool prior to being published as a Hosted Feature Layer in AGOL. Survey123 accepts these values just fine and automatically places its geopoint on top of the Collector point.

The potential issue I need to address, is situations in which the field collectors will need to move the Collector point because it may not be located in the correct spot. If it continues to pass those stop_lat and stop_lon values, Survey123 will place its geopoint at the original coordinates rather than the updated ones.

To address this, I used information from a combination of these two resources (understanding-survey123s-custom-url-scheme) and (how-can-i-get-xy-in-dec-degrees-from-a-poly-feat-serv-using-arcade). It gets me to a 90% solution though. I am able to extract the lat/longs from the Collector point geometry and convert to decimal degrees using slightly modified versions of Xander's code. When I look at the hyperlink in my Collector pop-up, it appears to be passing on those values as intended. However, for some reason Survey123 does not appear to recognize them, and places its geopoint at the location that my device's GPS says I'm at.

So my thoughts are, that maybe I am using an incorrect format for passing those values calculated in the attribute expressions to Survey123. This is what I am currently using in my Collector pop-up:

arcgis-survey123://?ItemID=2b630de13e764c889f6e010246701471&field:globalid={GlobalID}&field:stop_id={stop_id}&field:stop_name={stop_name}&field:agency_id={agency_id}&field:agency_name={agency_name}&field:row={row}&field:city={CITY}&field:district={district}&center={expression/expr1},{expression/expr0}

I have looked at the number of decimal places for expr1 and expr0 and they are both set to 8 decimal places; so that isn't the issue. I have tried using the nice titles of the expressions, in my case GeometryY and GeometryX, but those are not recognized at all. Is {expression/expr1} and {expression/expr0} the correct format for centering the Survey123 geopoint?

Can anyone spot what my flaw may be?

I'm wondering if maybe I've been looking at it too long and can't see what I am missing.

Thank you in advance for the guidance or direction that anyone can provide.

1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

Just did a simple test; removed the symbology based on Arcade and replaced it by a simple renderer since Aurora has had problems with symbology based on Arcade in the past (not sure if this is still the case). I left my pop-up without changes and opened the map in Aurora and clicked on a point. The HTML / Arcade pop-up showed up perfectly:

When I click on the link it will ask me what I want to do and I clicked on Abrir (Open). You can see in the URL that for instance the coordinates are included:

The web survey will open and parameter values are passed to the form as you can see with the coordinates:

Hope this helps.

View solution in original post

10 Replies
JohnathanHasthorpe
Esri Regular Contributor

Hi Joseph 

Can you try passing the coordinates in as a single coordinate pair, not two separate fields:

center=43.567,-117.380

center={XY Field}

Try creating a field that contains the coordinate pair (separated by a comma) and then update this.

Thanks

John

 

0 Kudos
JosephDrahos
Emerging Contributor

Good morning John and thanks for the feedback.

Unfortunately, that does not help with my current situation. I have been able to successfully send two separate fields of coordinates to center my Survey123 geopoint. That works just fine for me.

What I am trying to do is utilize the Attribute Expressions to pull the coordinate directly from the point geometry in Collector, then send that to Survey123. This will enable me to always use the most up-to-date location in case a field collector needs to move the point in Collector first. If I use 1 or 2 existing fields with the coordinate information, then any Survey123 form that gets filled out will have its geopoint placed at the coordinates sent by the fields; not by the (potentially) updated coordinates from the geometry.

The only thing I can determine as being the cause, is the Attribute Expression itself. It is like Survey123 does not recognize what an Attribute Expression even is. Am I jumping the gun and trying to leverage this feature before it has been incorporated into Collector or Survey123 yet?

Thanks.

0 Kudos
ChaimSchwartz4
Frequent Contributor

Hi Joseph,

This following URL scheme works for me for passing location from the geometry of a point feature service in a webmap, to survey123. What this does, is that it passes the pair of coordinates (lat long with only space between them, no comma, as described here) to the "passedCentroidLatLong" field in the feature service that survey123 is editing. You also have to make sure that your location in the survey123 is defaulted to this passed location info, and that it is read only. 

I didn't test it in collector.

For converting the decimal degrees I used Michael Kelly's post here.

<a href="arcgis-survey123://?itemID=942422bb51604b4783feb03caa31abbb&amp;field:workOrderId=CSR-{objectID}&amp;field:description={descriptionOfRequest}&amp;field:passedCentroidLatLong={expression/expr0}" target="_blank">Create new work order</a>

Chaim

XanderBakker
Esri Esteemed Contributor

Last week I posted a document which explains how to create a pop-up window containing a link to a Survey123 form and sending some fields and the coordinates (unfortunately, it is in Spanish) : Usar Expresiones Arcade para Cumplir con la Resolución 030 de la CREG (scroll down to the last Arcade expression).

Since Aurora (https://community.esri.com/community/gis/applications/collector-for-arcgis/blog/2017/09/06/the-auror... , the new generation Collector App is soon to be released and has some support for Arcade) this might work. I will do some testing next Monday and post back if it works. 

ChaimSchwartz4
Frequent Contributor

Thank you - that is a great article, and google translate did a good job translating it to me:) I will definitely be happy to hear what you find with the collector/aurora, and I will also try out your arcade approach for launching survey123, because one challenge I wasn't able overcome yet is that my above URL scheme, when opened through a webmap pop up, first openes a blank webpage, before launching the windows survey123 app which is a little bit annoying. Would you have an idea how to get rid of that? Changing the "target" tag didn't work for me.

Edit: I used arcade as in your example instead of my URL scheme and still experience the same issue - a blank web page is first created. Is that happening to you as well Xander Bakker‌?

Thanks

Chaim

XanderBakker
Esri Esteemed Contributor

Hi Chaim Schwartz , for our example we used the web version of Survey123, since the form was a public faced form and we can't expect the public to have Survey123 for windows installed. I will give it a shot with Aurora to see if it is supported, but might not be able to do it on Monday. Will definitely post back my findings.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Just did a simple test; removed the symbology based on Arcade and replaced it by a simple renderer since Aurora has had problems with symbology based on Arcade in the past (not sure if this is still the case). I left my pop-up without changes and opened the map in Aurora and clicked on a point. The HTML / Arcade pop-up showed up perfectly:

When I click on the link it will ask me what I want to do and I clicked on Abrir (Open). You can see in the URL that for instance the coordinates are included:

The web survey will open and parameter values are passed to the form as you can see with the coordinates:

Hope this helps.

JosephDrahos
Emerging Contributor

Thanks for continuing to follow-up on this. Arcade has some great potential, so now it seems it's just a matter of waiting for Aurora to release.

Also, I realized that I never marked this post as answered. It seems that the Arcade functionality of Collector Aurora is the answer to this particular question.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Very true... but as far as I have heard, it will be available very soon. First for iOS and later this year for Android if everything goes according to plan.

0 Kudos