Hi, the field surveyor misunderstood what a test was, and did a full day of work and gave remarks on updates afterwards. The updates changed the datamodel. We know how that goes.
Everything went smoothly moving GUID's around, matching the related tables and such. However, I'm confused about the attachments, that one photo that was made in the main service. It seems to work in related tables. I only noticed this, when I should create reports where that very first attachment isn't in the survey field, where the attachment from the new submitted records has the attachment, although that part of the survey never changed.
In AGOL, all photos and files are stored in the same field, but apparently, that doesn't seem to link to the survey field, so for 80 records, I can't get that photo into the report.
In survey123 data, the photo from the backup is shown at attachments:
The new records (and how it was before recreating the service) The photo was connected to the question:
How can that be solved?
Thanks
Solved! Go to Solution.
Attachments aren't really connected to fields, they all exist in one attachment table per source table. For example, if your service contains a main layer with attachments and a related table with attachments, your main layer would have one attachment table and your related table would have its own attachment table.
These attachment tables are obfuscated from clients by the REST API when using ArcGIS Online, but if you're accessing attachments in a geodatabase you can see them for what they are.
Attachments are linked to specific questions in Survey123 by a "Keywords" field in these attachment tables. You can think of it like a metadata description field. When the Survey123 client posts files to the attachments table, it writes the name of the question into this Keywords field. Survey123 reporting uses these keywords to determine which photos came from which questions.
If you're looking at attachments via a client like the Map Viewer or ArcGIS Pro, you won't see these keywords, but if you look at them through a REST API query, you will (this specific example isn't from Survey123, so it doesn't, but this is where you'd see them):
Anyhow, depending how you brought your photos across from one service to the other, you may have lost these keywords, and if you've lost those keywords, you've lost the link between the photos and which specific question they're associated with.
When I'm migrating photos from one Survey123 service to another - usually in a scenario exactly like the one you've describe - I'll use the ArcGIS API for Python to download each photo along with its keywords, then post each photo across to the new service, with the keywords as part of that operation, keeping everything intact.
You'll want to look at the Attachment Manager class for this, specifically the get_list, download and add methods.
Attachments aren't really connected to fields, they all exist in one attachment table per source table. For example, if your service contains a main layer with attachments and a related table with attachments, your main layer would have one attachment table and your related table would have its own attachment table.
These attachment tables are obfuscated from clients by the REST API when using ArcGIS Online, but if you're accessing attachments in a geodatabase you can see them for what they are.
Attachments are linked to specific questions in Survey123 by a "Keywords" field in these attachment tables. You can think of it like a metadata description field. When the Survey123 client posts files to the attachments table, it writes the name of the question into this Keywords field. Survey123 reporting uses these keywords to determine which photos came from which questions.
If you're looking at attachments via a client like the Map Viewer or ArcGIS Pro, you won't see these keywords, but if you look at them through a REST API query, you will (this specific example isn't from Survey123, so it doesn't, but this is where you'd see them):
Anyhow, depending how you brought your photos across from one service to the other, you may have lost these keywords, and if you've lost those keywords, you've lost the link between the photos and which specific question they're associated with.
When I'm migrating photos from one Survey123 service to another - usually in a scenario exactly like the one you've describe - I'll use the ArcGIS API for Python to download each photo along with its keywords, then post each photo across to the new service, with the keywords as part of that operation, keeping everything intact.
You'll want to look at the Attachment Manager class for this, specifically the get_list, download and add methods.
Thanks MobiusSnake, Whoops, that's spot on. The keyword is missing on the old registrations.
Did it with a gdb export, so that is exactly what is the use case for this guide:
Update attachment keywords | ArcGIS Survey123
An easier quick and dirty method, just add:
${#$attachment} ${$file} ${/}
Then it will load all the photos from the attachment instead of the survey reasons:
How To: Print Attachments That Were Not Submitted via Survey123 App in the Feature Report
It's not something we've done that often. Thank you so much, now I know what to do 🙂