Select to view content in your preferred language

How to view and edit data in the attachment tables in ArcGIS Pro

1345
3
04-26-2023 07:51 AM
ChristopherVan_de_Wyngard
Emerging Contributor

How can I edit the attachment tables of my Survey123 survey in ArcGIS Pro. Can anyone provide a step-by-step guide on how to do this? Specifically, I want to know how to view and then edit data in the attachment tables and ensure that my changes are reflected in the related records in the main survey form.

Any tips or best practices for editing attachment tables in ArcGIS Pro would be appreciated.

0 Kudos
3 Replies
MobiusSnake
MVP Regular Contributor

Can you give a specific example of what you're trying to do?

If you've downloaded your data into a local GDB you have a bit more flexibility than you do when editing data via services, the REST API for attachments is more limited than what you can do with database table.

0 Kudos
ChristopherVan_de_Wyngard
Emerging Contributor

I have completed several steps, including downloading a File Geodatabase to back up my surveys and attachments. Next, I added a repeat to my existing survey, which resulted in the loss of all my data. I then appended the layers, but since the pre-existing related tables were using the Global ID to relate to other tables, I had to reconfigure the parents' global ID to match the newly generated Global IDs.

However, even though I had set the environment to Maintain Attachments in ArcGIS Pro, I noticed that none of my attachments were present once the tables were related.

I am not sure if I am missing something to successfully add a repeat to an existing survey without loosing the data and attachments.

0 Kudos
MobiusSnake
MVP Regular Contributor

Adding a repeat to an existing survey is very tricky, I don't think S123 Connect can do it while maintaining your data (I could be wrong though).  It's been a while since I've done this, but I think you could do it a few different ways:

Method 1

  • Export and download your existing service's schema to a FGDB
  • Add a new table & relationship class for the repeat
  • Zip the FGDB and publish as a new service, modify the settings to match your old service (views, sharing, editing settings, etc.)
  • Republish the form to point to the new service

This has some downsides, like if you have webmaps/apps that use your S123 service they'll have to be modified to point to the new service.  Additionally, FGDB exports tend to flake out if you have more than (approximately) 1.5GB worth of data - feature + attachments - in the export.

Method 2

  • Open the administrative REST API of the service
  • Use the Add to Definition endpoint to add a new table
  • Use the same endpoint to define a relationship between the parent and the child
  • Modify the form to include the repeat and republish

This is "cleaner" but it's really easy to completely screw up your service this way.  You really want to practice this on some garbage data before trying it against anything that matters.

Method 3

  • Publish your form to a new service entirely, that includes the repeat
  • Use the Python API to script up an ETL process to drag your old records and attachments over to the new service

The downside here is that it can be fair bit of work, especially if you're not handy with Python.  Also, repointing webmaps/apps and such.