How do I make my Survey123 survey a Related Table to a Feature Class?

4767
6
03-14-2019 03:16 PM
Highlighted
New Contributor II

I have created a tree inspection survey in Survey123 Connect and want the data to go into a related table to a tree point feature class in AGOL. I am using Collector to view the tree points and have configured the pop-up to include the survey link and populate two of the survey fields with data from the tree points. However, when I collect the data it is stored in the survey feature class rather than the related table. I can't figure out where I've gone wrong.

 

Here’s my workflow:

 

  1.  Create survey in Survey123 Connect (I have a hidden GUID field with esrifieldtype:GUID - I'm not sure how the GUID is entered)
  2.   Publish survey to AGOL
  3. Export published survey from AGOL to file geodatabase and download to my computer
  4. Export the tree point feature class from a different geodatabase into the downloaded survey geodatabase
  5. Add a Global ID to the tree point feature class
  6. Create a geodatabase relationship (Tool: Create Relationship Class) of 1:M with the tree points being the original table and the survey being the destination table. Origin primary key: GLOBAL ID from tree point feature class and origin foreign key: GUID from survey point feature class.
  7. Add both features to an mxd with the survey point first in the Table of Contents
  8. Publish to AGOL as a new feature service – double check that the survey layer has FeatureServer/0 in its web address. I notice that the GUID field does not show up in the attribute table after publishing - something's wrong here. Enable editing/sync
  9. In Survey123 Connect, delete .iteminfo file from the project folder
  10. In AGOL delete the original associated Survey123 folder
  11. Republish the Survey123 project
  12. Create a web map with the newly published feature service (tree points and survey layer)
  13. Configure pop-up to include link to survey (this works) and populate two survey questions with data from the tree point (this also works)

 

BUT, the data I collect goes into the republished survey123 project and not the related table to the tree points. There's obviously something wrong with my GUID, or lack of one, and I wonder if I need a submission url in my survey?

 

I have managed to attain success after much trial and error - here's my adjust workflow:

  1. Create survey in Survey123 Connect (Must have a GUID field with esrifieldtype:GUID – mine is a hidden field)
  2. Publish survey to AGOL
  3. Export published survey from AGOL to file geodatabase and download to computer
  4. Export the tree point feature class from a different geodatabase into the downloaded survey geodatabase
  5. Add a Global ID to the tree point feature class (Data Management Tools, Fields, Add Global IDs)
  6. Create a geodatabase relationship (Data Management Tools, Relationship Classes, Create Relationship Class) of 1:M with the tree points being the original table and the survey being the destination table. Origin primary key: GLOBAL ID from tree point feature class and origin foreign key: GUID from survey point feature class.
  7. Add both features to an mxd or ArcPro project with the survey point first in the Table of Contents
  8. Publish to AGOL as a new feature service – double check that the published survey layer has FeatureServer/0 in its web address. Enable editing/sync for use in Collector.
  9. In Survey123 Connect, on the xls form Settings tab, add in the submission url – https://www.arcgis.com/sharing/rest/content/items/itemID - note, I used the item id of the target layer in my feature service (the survey layer). I found this item ID by following the JSON link on the ArcGIS REST Services Directory of the target layer (click on target layer name of the feature service). The form id only needs to be filled in if the target layer has a different name from the xls form file name. In my case it doesn’t.
  10. In Survey123 Connect, in the project folder, delete the .iteminfo file (I don’t know exactly what this does but it appears to be necessary)
  11. In AGOL delete the original associated Survey123 folder
  12. Republish the Survey123 project
  13. In survey123.arcgis.com click on the newly republished survey, then go to the Collaborate tab, and make sure that ‘Open the survey in the Survey123 field app directly’ is selected.
  14. Create a web map with the newly published feature service (tree points and survey layer)
  15. Configure pop-up of tree point feature to include link to survey and populate two survey questions with data from the tree points. NOTE: the item id used in the link to the survey is not the same as the item id that is in the submission url. This item id is the one that is for the republished survey form. You can find that item id in the web address of the survey through survey123.arcgis.com
  16. Make sure to download the newly published survey to Survey123 app before using Collector or Explorer.

I hope this helps anyone else struggling with this task.

Francesca

6 Replies
Highlighted
Esri Regular Contributor

Hi Francesca, glad to hear you got it working.

Please let us know if you have any further queries.

Regards,

Jim

Reply
0 Kudos
Highlighted
Occasional Contributor

Hi Francesca and Jim; thanks for providing this workflow info. I am trying to do the same thing, just with hydrant flow test forms related to hydrants.

I get to step 12 (republish from Survey123 Connect), and I get an error saying: "The custom feature service submission_url is not compatible with this survey (Table HydTest_Test not found)."

I am trying to determine if I got the submission URL wrong because I didn't completely understand your instructions, or if I am not able to use a custom submission URL because of some other setting.

In step 9, is that URL verbatim up until ".../itemID"? Meaning, should you just replace the "itemID" with the ID from your survey layer service? Would this actually be the "ServiceItemId" listed in the JSON (a 32 character long unique ID, possibly a GUID). For example: https://www.arcgis.com/sharing/rest/content/items/###############################

Or would we use the whole service definition URL as it appears in a browser when you click on the service definition? For example: https://services9.arcgis.com/S87ZWifpvPdYZ4nJ/arcgis/rest/services/HydrantTest_Survey/FeatureServer/...

Reply
0 Kudos
Highlighted
Esri Regular Contributor

Hi Joe

Thanks for your query. The submission_url should look like the first option you mention, i.e. https://www.arcgis.com/sharing/rest/content/items/<itemId> (item ID of the target feature service).

Accessing a related table usually requires a combination of submission_url and form_id. As Francesca mentioned, if form_id is blank the survey attempts to target a layer in the feature service with the same name as the XLS file.

Note that the safest & easiest way to build a survey from an existing feature service is to use the New Survey > Feature Service option in Survey123 Connect. Connect will automatically create an XLSForm based on the fields in the feature service (including its related tables as repeats), which can then be modified to suit your needs before publishing.

Working with existing feature services is covered in detail in this very useful blog post:

https://community.esri.com/groups/survey123/blog/2017/09/25/working-with-existing-feature-services-i...

And documented here:

https://doc.arcgis.com/en/survey123/desktop/create-surveys/survey123withexistingfeatureservices.htm

Which will also lead you to this technical article:

https://support.esri.com/en/technical-article/000014835

Hope this helps, please let us know how it goes.

Best regards,

Jim

Highlighted
New Contributor II

Great workflow Francesca, works great so far, but I am stuck at configuring the pop-ups.  Can you elaborate some there with maybe a screenshot?  Any help is greatly appreciated.

Reply
0 Kudos
Highlighted
Esri Esteemed Contributor
Highlighted
New Contributor

I'll start this off with saying that I feel about ArcGIS the same way I feel about cooking. Give me a set of instructions and I can make the food taste right and once I have it working I can see where I can add some flair. 

With that said, I love the way this post structured, but before I dive into it, I wanted to ask if I'm understanding what product these instructions yield. Would the way this is structured let you use a preexisting Feature class to prepopulate a survey123 form with some of its fields? I've tried to look for something that would pull data from a feature service, but everything I read says I can't do that.

I wanted to use survey123 to collect data for a report that my inspectors submit, but the problem I have with collector is that data the GUI isn't friendly for some of the data we collect while in the field. Additionally, I wanted to perform multiple inspections and keep the data. I didn't want to be editing existing features or have the inspectors manually adding points possibly dotting everywhere on a map nearby the relevant point instead of the appropriate coordinates. It sounds like you might have created what I was looking for. 

Existing feature class -> link to survey carrying over some of the fields essentially prepopulating them if the key's match -> filling out other relevant fields to that point -> submitting. 

Reply
0 Kudos