Select to view content in your preferred language

Multiple photos Survey 123

2376
5
07-03-2018 05:17 AM
Jodie_M_Gosselin
Regular Contributor

My survey allows for multiple photos. Once I download and extract the photos, is there an automated way to join the photo names from the attachment table to the one record for that survey? Ideally, I would like each record in my survey to have a field for [PHOTO1], [PHOTO2], [PHOTO3], etc.

0 Kudos
5 Replies
by Anonymous User
Not applicable

Jodie,

There is a way of doing this, but without seeing certain items within your data schema I cannot give you the direct answer. However, I can lend a hand in helping you possibly achieve what you are looking to do.

Typically within the Survey123 application you will have the Parent feature (point) that has the related table as a child feature. Within each of the tables there will be a GUID field that contains one of two things and named in a certain manner.

Parent Feature table will contain a database field named "GlobalID" and this contains a unique ID. When you add in the ability to store photos, there will be a related table created that is named the same as your feature with the suffix "__ATTACH" within it's name. This table contains the photos that the person filling out the form submits.

Within the attachments table you will notice a data field called "ATT_NAME" and this contains a name of each photo that is submitted with the survey. The name of the photo typically reflects the Name of the "image" question, followed by number of the of the photo being submitted and then a unique ID with the suffix ".jpg"

Here is an example from one of my attachment table values for ATT_NAME entry "BC_Photo1-3d10e77696b844e0aef886930f1ed250.JPG". What I did was the following steps -

  1. In the table of Contents within ArcGIS, I would right click on the Attachment table and choose "Joins and Relates" and then "Joins...".
  2. I would use the "Join attributes from a table"
    1. Step one choose the "REL_GLOBALID" field to base the join on
    2. choose the feature that was created by your survey
    3. choose the "GLOBALID" for the field in the table to base the join on.
    4. Then validate; there should be a complete one to one match (if you have 10 photos, then there should be a 10 of 10 match)
  3. This will join the features table to the attachment table.
  4. Start editing on the attachment table
  5. If you have a "Unique ID" within your feature that you want to be added into the Photo name, then you could use a calculation that would take the value for that data field and concatenate it with a portion of the value within the "ATT_NAME" by using a "left()" command.
    1. For my example the field calculation would be [BC_Data.BC_Net_ID] +"_"+ (Left( [BC_Data__ATTACH.ATT_NAME],9 )) +".jpg"
  6. This will pull the the first 9 characters of the ATT_NAME data value or "BC_Photo1" and concatenate it with our unique ID; in this case "KM001" to give us a photo name of "KM001_BC_Photo1.jpg".
  7. If you do not have a unique ID, then you could potentially use the "left()" command to pull just the first 9 characters of the photo name, but this will create an issue of overwriting photos, since a lot of the photos will have the same name. Hence why I give each photo a unique name.
  8. Then you would have to use the export attachments script to export the photos into a folder.

I do know that these have been previous scripts created that would export the attachments for a hosted feature service and one of them that will allow for the creation of a folder based on unique feature field and then only the photos for it will be exported into that folder. You could potentially end up with a lot of folder to go through.

https://community.esri.com/docs/DOC-6496-download-arcgis-online-feature-service-or-arcgis-server-fea... 

I hope this helps you get to how you would like to have the your photos named.

Mike

Jodie_M_Gosselin
Regular Contributor

Thank you, Mike. I wasn't clear on my question. I have multiple photos for each record (point) in my survey. My ATTACH table has each of these photos listed as a separate entry and I would like to somehow join each of these photo names to the one point in my survey feature class. In a sense, I need to flatten the one-to-many relationship. I've played around with various tools, but can't seem to automate this. Do you know of a way to easily do this? Thanks, again!

0 Kudos
by Anonymous User
Not applicable

Hello Jodie,

So, you are attempting to the push the "names" of the photos found within the "ATT_NAME" data field of the attachment table into a data field within the parent feature class?

Is that what you are trying to do?

0 Kudos
Jodie_M_Gosselin
Regular Contributor

Yes, I would like to add many fields to the record in the parent feature class. I would like each field to hold one photo name that is associated with that feature in the ATT_NAME field. So I'd like to add the fields [PHOTO1], [PHOTO2], [PHOTO3], and so on. Some of my records have up to 21 photos and I'd like to have each photo name captured in the parent feature class. I need this to send to another department in Excel so that they can reference the photos as they are stored on our server.

0 Kudos
TamsynG
New Contributor

Hi Jodie, Did you ever resolve this issue? I am in the same situation where I have more than one photo related to a record and I cannot seem to get a one-to-many join to work in ArcGIS Pro

0 Kudos