In the past I have been able to pull all the photos from a FGDB that were taken in Survey123 or Collector and name them through a series of steps in ArcMap. Each point or polygon the photos are attached to usually have more than one photo. An attachment table will look like this. Site 10 has two photos, site 11 has two photos etc.

What did I do to get the photo names like this in the Filenames column?

Ideally, I need it like this in Excel but I can't figure out how to do that either.

This is from the feature service table and the file names, granted without the preceding number- which is ok if need be, are in the row with their correlating site. So both photo names associated with site 10 are in row 10's 'filenames' column. Basically, I need all the Attachment Names associated with a site in the same cell (or same row) as the site. One row per site. Not multiple rows like the attachment table.

I am taking the photos and completing a mail merge through excel/word. It's a whole rigmarole - a bit of a nightmare you probably can imagine.

I cannot for the life of me remember what I did to get the names how I need them. I am not skilled with Python so I definitely didn't do it that way.

  • Can you add example photo names as text? What do you have and what are you trying to end up with - as text please? It's hard to figure that out from your images
    – jbalk
    Commented Nov 15, 2022 at 22:31

1 Answer 1


Use this:

def GroupOrder(groupID):
  return N
GroupOrder( !REL_OBJECTID! )

to populate new field:

enter image description here


enter image description here

to get table similar to this:

enter image description here

You can concatenate field values in above into single column (in Excel if this is easiest for you) and join to parent points table

  • Thanks for your response @FelixIP ! I am trying to populate the new field with your script above replacing the ( !REL_OBJECTID! ) with ( !GIS_ID! ) - that's the column that reflects the number of photos in my table. But I am getting an error. I don't really know python or VB so it's likely something I am doing wrong. def GroupOrder(groupID): N=d.get(groupID,0);N+=1 d[groupID]=N return N #-------- GroupOrder( !GIS_ID! ) I also may have 5 or 6 photos for one site, if that makes a difference?
    – Sara
    Commented Nov 16, 2022 at 16:23
  • In your case it should be GroupOrder( !REL_GLOBALID! ) and it has nothing to do with pre-calculated attachments count. Just add field called ONE to attachment table and populate it using advanced Python window, have a good look at 1st picture. Number of new fields (produced by Pivot tool) will be equal to maximum no of attachments. If you don't know how to use advanced field calculator, too bad.
    – FelixIP
    Commented Nov 16, 2022 at 20:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.