Select to view content in your preferred language

Survey123 feature class as a related table

38198
87
Jump to solution
08-22-2016 09:43 PM
GordonSumerling
Esri Regular Contributor

Hello All,

I need to understand how it might be possible for my Survey123 feature class to be a related table to a polygon feature in the map.

In essence I have a farm field feature class and I want to perform an inspection against this. Conventionally, I would create a feature class to represent the farm in ArcMap and then create a related feature class in ArcGIS that is the inspection feature class. Now I could use this in collector. However, I want to take advantage of the field manipulation capability of Survey123. 

The inspector already knows the farm ID so he just needs to perform the inspection with survey123. So the question is how do I publish the survey123 feature class and then relate it to the farm polygon feature class in ArcGIS Online?

Cheers

Gordon

87 Replies
BrandonKeinath1
Occasional Contributor III

Thanks Tucker.  After I enabled the unique ids I made the table layer 0 and the feature class layer 1.  After that I was unable to publish the hosted feature service.  It always resulted in an error and the service wouldn't publish.  When I make the feature class 0 and the table 1 it works again.  Any ideas?  Have you succeded in publishing a service with the table as layer 0?

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Brandon,

It looks like you're running into a fundamental publishing issue with ArcGIS Server.  That being said, this should be easy to work around- specify the name of the table (TroubleCause) in the form_id setting to point the survey at your table; the publishing order won't matter.

0 Kudos
AhjungKim4
Occasional Contributor II

Ismael, thank you for posting the update. I tried what you had described and was able to create a Survey123 form using a related table of an existing hosted feature service. However, my submission via Survey123 creates orphaned records. What I want to do is to view an existing feature in Collector and if it requires inspection, use a link in Collector pop-up to launch Survey123 (iOS) and fill out the inspection table which is related to the parent feature I selected in Collector.  Is this a possible workflow with current release?  

Updated response June 15: In 2.0 and newer versions, you can create a survey that works against an existing related table. In Connect, go to New Survey, then select Feature Service and pick your feature service from the gallery. Once the XLSForm is loaded, eliminate the questions relative to the parent layer. Eliminate the rows with the  begin and end repeat statemnts. Then change the FormID value in the Settings tab so it references the name of the related table you want to edit.
0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Ahjung,

Are you passing the parent's GlobalID into the parentglobalid of the form?  This is needed to create the relationship.

AhjungKim4
Occasional Contributor II

This is the parent hosted feature layer with related tables.  

http://arcgis.com/home/item.html?id=918ca7dce5834b1585c878ed42a15341 

I follow the instructions here and created a form that would create new Occupant records. 

Updated response June 15: In 2.0 and newer versions, you can create a survey that works against an existing related table. In Connect, go to New Survey, then select Feature Service and pick your feature service from the gallery. Once the XLSForm is loaded, eliminate the questions relative to the parent layer. Eliminate the rows with the  begin and end repeat statemnts. Then change the FormID value in the Settings tab so it references the name of the related table you want to edit.

This is the URL opens Survey123 and I am able to create new Occupant records from Survey123 but it is orphaned. 

arcgis-survey123://?itemID=11c78858e316472d90752b94ecdf4317&field:parentglobalid={8799257a-00ac-4983...

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Trying out the link you provided, I'm getting an error on submission form the Survey123 application - it's wrapping the GUID you provided in an extra set of braces ("{", "}").  This raises up a second question - are we submitting the data via the web form or the field application?

AhjungKim4
Occasional Contributor II

James, thank you for looking into this. I removed the {} from the URL and the form now populates the GUID field in related table. I am using Survey123 for iOS and Survey123 for Windows (called from ArcGIS Pro) and it works correctly in both of the clients. Thanks again for your help.

Field calculate:

"arcgis-survey123://?itemID=11c78858e316472d90752b94ecdf4317&field:parentglobalid="+!globalid![1:-1]

0 Kudos
AaronThompson
New Contributor III

Wow, thank you for this answer! I was struggling to get my surveys to submit with a upload error code 400, and the curly brackets around the GlobalID i was passing was the problem!

Here's my new question: I pass a parent feature's GlobalID through a custom URL scheme in the Collector app, and then I can manually go and delete the brackets once the survey123 app opens. Is there a way to do this automatically? Like string formatting?

Thanks!

0 Kudos
AhjungKim4
Occasional Contributor II

You can remove curly braces when you populate the custom URLs. I used below Python code in field calculate tool.

"arcgis-survey123://?itemID=11c78858e316472d90752b94ecdf4317&field:parentglobalid="+!globalid![1:-1]

"globalid![1:-1]" removes first and last characters, which are { and }, from global ID.

Also, I would hide the GUID field in Survey so field staff doesn't accidentally edit the copied global ID and create an orphaned record.

0 Kudos
AaronThompson
New Contributor III

Thanks for the fast reply Don't worry, I know how to perform the string slice in a field calc with python, but i can't use python in a custom popup...

So I won't be building this URL into a field, but instead creating it from a popup in Collector, utilizing custom html popups. Per the description provided here: https://community.esri.com/groups/survey123/blog/2016/07/30/understanding-survey123s-custom-url-sche...

Is there a way to implement this same string slice into a popup in a webmap? 

0 Kudos