Sync local changes to survey's feature service

1399
8
Jump to solution
03-01-2019 03:57 PM
NickDierks1
Occasional Contributor II

I'm trying to work out how to update a hosted feature service used by Survey123 by pushing said updates from a local geodatabase. Here's the background of what I've done and am hoping to accomplish:

  • I have water utility data in a geometric network (file geodatabase) that I edit using ArcMap 10.6.
  • I created a relationship class with the hydrants layer and a table for recording flow testing.
    • The relationship is based on GlobalID/GUID.
  • I published the hydrants layer as a hosted feature service, and then created a survey based on that service using Connect.
    • The intent of the survey is to only create new records in the related table. The data in the parent hydrants layer is visible but read-only.
    • This process worked out alright during testing.
  • I then downloaded the data and updated the local table (in the fGDB) with the new records created in the hosted table.
    • Again, looking at the related hydrants, this seemed to work fine.
  • As a test, I decided to edit the local hydrants layer (added a new record using ArcMap).
  • Then I switched to ArcPro, added the layer, and clicked Sharing > Overwrite Web Layer.
    • I'm thinking this is where I broke it...
  • When I went to check (both using the field app and on the Survey123 website), I started running into problems:
    • On the Data page: All records display on the map and in the table just fine. However, when clicking any record to open the Individual Response pane, the pane loads indefinitely, never displaying any data.
    • On the Analyze page: Statistics display just fine for the fields in the parent layer, but when I scroll down to where the repeat would start, again it just loads indefinitely.
      • (I did not check the Analyze page before I broke things, so I'm not sure if it was supposed to work anyway)
    • In the field app: Refreshing the Inbox gets stuck on "Searching for Surveys". If collecting a new record, I can fill it out just fine, but it hangs when trying to submit the survey.

I'm guessing something went wrong when I tried to update the hosted layer with the local feature class. Is there a different way to sync local changes to the hosted layer? Did I just goof up and miss a critical step or setting? Or is there no reasonable solution to the workflow I'm trying to accomplish? I can do my best to describe any of these steps in more detail if needed.

0 Kudos
1 Solution

Accepted Solutions
NickDierks1
Occasional Contributor II

I finally got it to work! Here's the complete workflow for initial setup:

  1. Set up the table of hydrant flow tests.
  2. Import the table to the file geodatabase that the hydrants layer is in.
  3. Add a GUID field to the table.
    1. Set up a join between hydrants and table based on Hydrant Number.
    2. Use the Field Calculator to populate the table's GUID field based on the Hydrant Layer's GlobalID field.
  4. Set up a relationship class based on this GlobalID to GUID relationship.
  5. Add a GlobalID field to the table.
  6. Share the layer with table as a hosted feature service.
  7. Open Surey123 Connect, create a new survey based on this hosted feature service.
  8. Set up the form/settings as needed:
    1. Users can only add new related records--can't add/edit new hydrants or edit existing flow test records.
    2. Allow querying of related records.
    3. Enable the Inbox and allow for a spatial query.
  9. Publish the survey and let the fieldworkers do their thing!

Now, I can download the recorded survey data any time I want and add any new records to the local table (need to use an SQL query during the import unless you want to duplicate older records!). Then, any time I make changes to the hydrants layer, I can share>overwrite the hosted feature service without any hiccups. Everything seems to work fine on the Survey123 website as well as the mobile app, so no more broken data!

Success!

View solution in original post

8 Replies
JohnathanHasthorpe
Esri Regular Contributor

When you did the Overwrite Web Layer in Pro - did you have both feature layer and the related table loaded into the table of contents? Also, can you share the service and database you are using to update it?

Thanks

John

0 Kudos
NickDierks1
Occasional Contributor II

I did have the table loaded in the ToC, yes.

Rather than upload the data here and/or make the service public, I shared both to a group and just invited you to it. If this doesn't work, let me know. Thanks for looking into this!

0 Kudos
JohnathanHasthorpe
Esri Regular Contributor

Hi Nick, can you share with jhasthorpe_survey123? Thanks

0 Kudos
NickDierks1
Occasional Contributor II

You're the only Hasthorpe to show up in a search for users to invite, so I know I have the right one. I tried sending again today from different browsers; if nothing is coming through, then I don't know what's going on, and I'm not sure how to share the data without making it public.

JohnathanHasthorpe
Esri Regular Contributor

Hi Nick

I love the art work on your group!

I had a look at the service that you shared and can see that it does not have a related table in it. This means that when you republished the service the table and layer were not related. This is the cause of the breakage in the website.

I also tested your workflow and can confirm that overwriting the service with a downloaded version of the data should preserve the relationship between the layer and table - and not cause issues.

Thanks

John

0 Kudos
NickDierks1
Occasional Contributor II

Unfortunately, the editing of the water utility data has to remain in ArcMap 10.6, for geometric network and Attribute Assistant functionalities. Manually replicating these edits in the hosted feature service would be a major duplication of work. This is especially important since we're still in the process of building the network, so there are constant updates and additions right now.

It's odd that the the layer and table weren't related when I republished, since I was already testing the related records from the downloaded data just moments before. I guess I'll have to play around and see why that wasn't preserved during the upload.

0 Kudos
NickDierks1
Occasional Contributor II

So, when looking at it again, I noticed that a GlobalID field was added to the table as it was originally published (the Hydrants layer already had a GlobalID). Thus, when I copied the downloaded new records into the local table and tried overwriting the hosted feature service with it, that's how it broke. The local table still has no GlobalID field (just the GUID field I initially created and based the relationship class on), so the the hosted feature service and survey were looking for a relationship based on the now-missing GlobalID.

How did you get it to work when you tested it?

0 Kudos
NickDierks1
Occasional Contributor II

I finally got it to work! Here's the complete workflow for initial setup:

  1. Set up the table of hydrant flow tests.
  2. Import the table to the file geodatabase that the hydrants layer is in.
  3. Add a GUID field to the table.
    1. Set up a join between hydrants and table based on Hydrant Number.
    2. Use the Field Calculator to populate the table's GUID field based on the Hydrant Layer's GlobalID field.
  4. Set up a relationship class based on this GlobalID to GUID relationship.
  5. Add a GlobalID field to the table.
  6. Share the layer with table as a hosted feature service.
  7. Open Surey123 Connect, create a new survey based on this hosted feature service.
  8. Set up the form/settings as needed:
    1. Users can only add new related records--can't add/edit new hydrants or edit existing flow test records.
    2. Allow querying of related records.
    3. Enable the Inbox and allow for a spatial query.
  9. Publish the survey and let the fieldworkers do their thing!

Now, I can download the recorded survey data any time I want and add any new records to the local table (need to use an SQL query during the import unless you want to duplicate older records!). Then, any time I make changes to the hydrants layer, I can share>overwrite the hosted feature service without any hiccups. Everything seems to work fine on the Survey123 website as well as the mobile app, so no more broken data!

Success!