Loading Survey123 data with Related Tables into a New Form?

996
5
04-17-2018 12:34 PM
Highlighted
Occasional Contributor

I have a Survey123 form with 4 repeat section with means 4 related tables.  I tried to update the form with some minor changes (only choices changes) but was faced with the "All your old data will be deleted" message, so I downloaded the data in a FGDB and overwrote the form.  How do I get the previously submitted data loaded back into the hosted feature services and related tables?  

 

For forms without related tables I can just cut & paste from the FGDB FC into the hosted feature service, but this does not work for related table data.  Any suggestions?

Reply
0 Kudos
5 Replies
Highlighted
by
Occasional Contributor III

Are repeat sections nested? Because at this moment Survey123 supports only one level of repeats...

Cheers

Stefano

Reply
0 Kudos
Highlighted
Occasional Contributor

Nope, they are not nested.  The original form and the new version of the form work well.  I just need to load the data from version 1 of the form that is now in a FGDB into version 2 of the form.  Exact same schema, just changes made to domains.  Not sure why it wouldn't let me update without deleting data previous data, but that seems to happen sometimes. 

Normally it is not a big deal to migrate the data into the new form by editing the feature service in ArcGIS Pro, but I don't see a procedure to copy rows from one table to another unless they are attribute values of tables:
Copying and pasting records in a table—Help | ArcGIS Desktop 

Reply
0 Kudos
Highlighted
Esri Esteemed Contributor

Hi Adam,

Normally the appropriate tool is Append—Data Management toolbox | ArcGIS Desktop , which has an environment setting to preserve GlobalIDs (see Preserve Global IDs (Environment setting)—Geoprocessing | ArcGIS Desktop); however, there is a limitation that may not make it suitable for the workflow involving FGDB.

In it's place, you can workaround this by utilizing the same procedure as GitHub - tedrick/SyncSurvey: Synchronize a Hosted Feature Service to an Enterprise Geodatabase (assuming this tool isn't working for you):

Use the CreateReplica endpoint of the of the feature service (Create Replica—ArcGIS REST API: Services Directory | ArcGIS for Developers )

  1. Filter out the records already synced in
  2. Add a new guid field, copy over the existing GlobalID values to preserve them
  3. Append into the parent form
    • Optional: export the the table with just new and old GlobalID fields for a lookup table
  4. Add a new field to each repeat to store the new globalID
  5. join the parent (or lookup) into the repeat based on the parentglobalid > old globalid
  6. copy the new globalid into the field
  7. remove the join, update parent globalid
Highlighted
New Contributor III

Hi James, I am struggling with this.

Unfortunately our work proxy wont allow me to do this via a script, so I am trying to do it manually.

my data is structured:

Header Table > Repeat > Photo attachment

If I use the 'Update Data', the header table data appends, but no data populates the repeat or attachment tables

I had a workaround that I published here Transfer data from old survey to new survey breaks relationship class  however this doesn't work anymore.

If I use pro to append, I can append the header table. When I append the repeat table I get a 'general function failure'. I also can't get it to 'Copy/Paste'. It seems that it is trying to maintain the globalID (even though I have turned off 'maintain globaids' and removed globalID from the field mapping) so throws an error as it cant edit the field.

What am I missing?

Here is the error from the copy/paste:

Reply
0 Kudos
Highlighted
Esri Esteemed Contributor

Hi James,

Based on your description, GlobalIDs in the repeat table would need to be preserved to maintain the relationship to the photos, correct?  It sounds like either data was previously submitted or copied over - can you select just the new records to append across?

Reply
0 Kudos