Select to view content in your preferred language

Pass Global ID from Collector to G

13038
33
01-25-2018 07:24 AM
KevinKozak
Regular Contributor

Has anyone been able to pass the Global ID from a service in Collector to the related GUID in Survey123 using the URL method?

I have a database relationship of Bridges to Inspections. In addition, Inspections have related Elements. Since Survey123 can only go two deep in relationships I have a service for Bridges in Collector and the Inspections and Elements in Survey123. I have created the Survey123 from the Inspection and Element service.

33 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Kevin,

What you're asking for is possible.  You would need to configure the Bridges layer's pop-up to have a url that includes the GlobalID in the parameters; this is described in Integrate with other apps—Survey123 for ArcGIS | ArcGIS and https://community.esri.com/groups/survey123/blog/2016/07/30/understanding-survey123s-custom-url-sche... .  This would go into a hidden field.

There is a known issue with Survey123 receiving the globalid value - it can't process the value if it already has curly braces ( { } ).  To get around that, the survey should be designed with 2 fields to handle the globalid value:

  • The first field (let's cal it "incoming") should be a hidden field (or text, if you want to validate that it's receiving the value) that has a fieldType null (so it isn't submitted to the database.  In your case, using an existing feature class, this would be added if you have Survey123 create a form based on the feature class
  • The second field (parentglobalid) will hold the value, minus any curly braces.  This can be a calculate (or again, text for validation checks) question with a formula like:
if(regex(${incoming}, '^\{[\w\-]*\}$'), substr(${incoming},1, string-length(${incoming}) - 1), ${incoming})

The regex detects if the guid is formatted as {1080901b-c30d-411b-a485-151c8f6ad8e6}, if the braces are present, it extracts the portion between the braces, otherwise it passes the guid unaltered.  The field type should by of esriFieldTypeGUID.

See the attached sheet for an example of this pattern.

KevinKozak
Regular Contributor

Hello James,

I appreciate your response. I read the articles you provided, they were informative. Being an old GIS dog trying to learn new tricks, I still have some questions.

  • My goal is to maintain the relationship class between the Bridge service’s GlobalID and the Bridge GUID in the Inspection service. If I have created the survey by importing the Inspection service schema, which has the Bridge GUID already and cannot be seen in the survey as a question, how would I list this existing GUID as a question? Documentation says that reserved fields in a feature layer are not added to the XLSForm, which GloabalID is a reserved word. Adding such a field with the same name would seem to change the Inspection schema and create a new service. Your example calls this the “theguid” in the XLSForm.
  • How does a GlobalID and GUID work if the curly brackets are removed?

Below is my thought process based upon your suggestions.

  • Bridge feature service has GlobalID field.
  • Inspection feature service has a GlobalID and brdg_guid fields.
  • In the Survey123 form have the following questions added:
    • brdg_guid_txt as type null
    • brdg_guid as type esriFieldTypeGUID and the calculation for the regex statement
  • Have Collector Bridge popup as: arcgis-survey123://?itemID=fe06d025e41a4ceabdb3dd1ba15713c6&field: brdg_guid ={GlobalID}

Thank you for your help,

Kevin 

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Kevin,

  • When Survey123 creates a form based on an existing feature service, it omits the GlobalID and GUID fields as the form rendered (including bridges and inspections) would automatically manage the relationships.  When switching to a URL-launched survey, we go from automatic management to manual management.  You need to manually add the ParentGUID question manually to accommodate this.
    From the question, are you planning to edit the Bridge layer when being launched by a hyperlink?  This is currently not supported; opening the app by hyperlink is supported for add only (Inspection form)
  • Survey123 supports fields with a bind::Esri:fieldType of null - this means that a question will not be submitted and has no effect on the table schemas
  • The curly braces are added automatically by Survey123, which is why they need to be removed

The URL as you've specified looks to be appropriate for what you're describing.

0 Kudos
ChrisBlinn1
Regular Contributor

Can the incoming and parentglobalid fields be hidden? When I set the type to hidden, it doesn't populate the parent GUID.

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Christopher,

Yes the fields can be hidden.  I will note that the workaround of having 2 different fields to normalize is no longer needed.  Make sure the hidden parentglobalid question has an esrifieldtype of esriFieldTypeGUID.

0 Kudos
ChrisBlinn1
Regular Contributor

So remove the regex as well?

0 Kudos
ChrisBlinn1
Regular Contributor

Update: I was able to get this working with a hidden parentglobalid field - thanks James!

0 Kudos
JosephGrossman
Occasional Contributor

Hi James, 

Thank you for all your advice throughout these forums. I am trying to create polygon, line or point features that collects a location and information in collector, than using the custom URL scheme pass the GlobalID and some information to a more detailed survey with repeats.

I wanted this Survey to publish data to the same feature service (different feature class and table) of the original feature so it can be related to the survey results in AGOL. I was able to make this work creating relationship files and publishing the Survey123. I was able to create the custom url and pass the global ID through to survey123 using the "if(regex(${incoming}, '^\{[\w\-]*\}$'), substr(${incoming},1, string-length(${incoming}) - 1), ${incoming})" formula.

My tests have shown that it works though the windows web interface and on IOS, but it will not pass the GlobalID though using Android. I am on Android 9 using the "Collector for ArcGIS" and Collector (BETA), as well as using Survey123 (4.1) as well as Survey123 (Classic). Any advice? Thanks! Joe

0 Kudos
StephenEJohnson
Emerging Contributor

I know this is an old question but I am trying to do this same operation and having no luck. If I understand correctly, Survey123 should now be able to hand correctly a GUID passed in a URL without first stripping the curly brackets? I must be having a different issue because I can't get Survey123 to process the GUID properly either way.

I have map set up with Field Maps. In that I collect some overall data for a group of samples. Once that data is collected I have a URL set up in the popup to open a survey and pass three field values to it. The first two a just text values and they work fine. The third is the GlobalID that I am passing to a parentglobalid field in the survey. The parentglobalid field always ends up blank in the survey. This is while using the Field Maps and Survey123 apps on an iPhone. Here is the odd thing, for testing I also set up the popup to have a separate URL to open the Survey123 web app. This one does pass the GlobalID. Below are the 2 generated URLs.

Phone app:

"<a href="arcgis-survey123://?itemID=afc70f91e8c648a7a2e87ed6f310eb8c&field:Control1=2400003&field:Gear1=935&field:parentglobalid=fafdf05b-554c-4d4c-b513-bc859dc871f1">Link to App Survey</a>"

Web App

"<a href="https://survey123.arcgis.com/share/afc70f91e8c648a7a2e87ed6f310eb8c?&field:Control1=2400003&field:Ge...">Link to Web Survey</a>"

 

0 Kudos