<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Adding multiple attachments to a single point using Generate Match Table and Add Attachments in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1209021#M59431</link>
    <description>&lt;P&gt;You're confusing &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/add-attachments.htm" target="_blank" rel="noopener"&gt;Add Attachments&lt;/A&gt; and &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/generate-attachment-match-table.htm" target="_blank" rel="noopener"&gt;Generate Attachment Match Table&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your bullet point is from Add Attachments and is absolutely correct. This tool can add multiple attachments for the same feature. For that to happen, the feature's key has to occur in multiple records of the match table. This is what my second screenshot shows: ID 1 is there multiple times.&lt;/P&gt;&lt;P&gt;What I was talking about is Generate Attachment Table, which... generates an attachment table. This tool is only able to perfectly match ID and file name. The only way you get multiple records with the same ID here is to have the same filenames, but different file extensions (1.jpg, 1.jpeg, 1.png, etc).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 02 Sep 2022 05:56:37 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2022-09-02T05:56:37Z</dc:date>
    <item>
      <title>Adding multiple attachments to a single point using Generate Match Table and Add Attachments</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1208515#M59362</link>
      <description>&lt;P&gt;I am trying to automatically add multiple photo attachments to a point using Add Attachments.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First I need to use Generate Match Table to create the match table, and am struggling to create a photo path for multiple attachments. My working folder has photos 18_1a, 18_1b, and 18_1c and my matching field is 18. This path works when there is a single "18" named photo, but the rest of the photos do not get picked up. How do I name these so the tool recognizes multiple attachments for my singular "18" point?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hayley_0-1661989475638.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/50084i478C35AEFF48353E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Hayley_0-1661989475638.png" alt="Hayley_0-1661989475638.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 23:46:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1208515#M59362</guid>
      <dc:creator>Hayley</dc:creator>
      <dc:date>2022-08-31T23:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple attachments to a single point using Generate Match Table and Add Attachments</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1208572#M59369</link>
      <description>&lt;P&gt;The tool only generates a 1:1 table, the match field and file name have to be exactly the same.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_0-1662012053621.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/50094iDBCE0E59F95D04EE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_0-1662012053621.png" alt="JohannesLindner_0-1662012053621.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With this little script, you can do what you want:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# same parameters as in the tool
in_table = "TestPoints"
in_folder = r"N:\ags1_daten\gewaesserkataster\Projekt\Bearbeitung\test"
out_match_table = r"memory\match2"
key_field = "OBJECTID"
input_data_filter = "*"  # eg "*.jpg"
relative_path = True


from pathlib import Path
# create match table
p = Path(out_match_table)
match_table = arcpy.management.CreateTable(str(p.parent), str(p.name))
arcpy.management.AddField(match_table, "Filename", "TEXT")
arcpy.management.AddField(match_table, "MatchID", "LONG")

# get all files that match your filter
in_files = list(Path(in_folder).glob(input_data_filter))

# for each row in in_table, get all files that match the key field or start with key field followed by "_"
with arcpy.da.InsertCursor(match_table, ["MatchID", "Filename"]) as i_cur:
    with arcpy.da.SearchCursor(in_table, [key_field]) as s_cur:
        for row in s_cur:
            key = str(row[0])
            for f in in_files:
                if f.stem == key or f.stem.startswith(key + "_"):
                    fn = f.name if relative_path else str(f)
                    i_cur.insertRow([row[0], fn])&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_1-1662013439588.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/50095i3284DDE79EFBF3DC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_1-1662013439588.png" alt="JohannesLindner_1-1662013439588.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 06:26:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1208572#M59369</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-09-01T06:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple attachments to a single point using Generate Match Table and Add Attachments</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1208994#M59426</link>
      <description>&lt;P&gt;That worked perfectly thank you so much!!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know why in the help documentation for the Add Attachments tool it says you can do multiple? "&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;EM&gt;Multiple files can be attached to a single feature class or table record. To accomplish this the&amp;nbsp;&lt;SPAN class=""&gt;Match Table&lt;/SPAN&gt;&amp;nbsp;should contain multiple records for that input ID (for example, record 1 has an InputID of&amp;nbsp;&lt;SPAN class=""&gt;1&lt;/SPAN&gt;&amp;nbsp;and a pathname&amp;nbsp;&lt;SPAN class=""&gt;pic1a.jpg&lt;/SPAN&gt;, and record 2 has an InputID of&amp;nbsp;&lt;SPAN class=""&gt;1&lt;/SPAN&gt;&amp;nbsp;and a pathname&amp;nbsp;&lt;SPAN class=""&gt;pic1b.jpg&lt;/SPAN&gt;).&lt;/EM&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Fri, 02 Sep 2022 04:20:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1208994#M59426</guid>
      <dc:creator>Hayley</dc:creator>
      <dc:date>2022-09-02T04:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple attachments to a single point using Generate Match Table and Add Attachments</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1209021#M59431</link>
      <description>&lt;P&gt;You're confusing &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/add-attachments.htm" target="_blank" rel="noopener"&gt;Add Attachments&lt;/A&gt; and &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/generate-attachment-match-table.htm" target="_blank" rel="noopener"&gt;Generate Attachment Match Table&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your bullet point is from Add Attachments and is absolutely correct. This tool can add multiple attachments for the same feature. For that to happen, the feature's key has to occur in multiple records of the match table. This is what my second screenshot shows: ID 1 is there multiple times.&lt;/P&gt;&lt;P&gt;What I was talking about is Generate Attachment Table, which... generates an attachment table. This tool is only able to perfectly match ID and file name. The only way you get multiple records with the same ID here is to have the same filenames, but different file extensions (1.jpg, 1.jpeg, 1.png, etc).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 05:56:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1209021#M59431</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-09-02T05:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple attachments to a single point using Generate Match Table and Add Attachments</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1209546#M59515</link>
      <description>&lt;P&gt;Ah oopsies, yes that makes sense, thank you!&lt;/P&gt;</description>
      <pubDate>Sun, 04 Sep 2022 01:57:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1209546#M59515</guid>
      <dc:creator>Hayley</dc:creator>
      <dc:date>2022-09-04T01:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple attachments to a single point using Generate Match Table and Add Attachments</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1224770#M61458</link>
      <description>&lt;P&gt;Hello Johannes,&lt;/P&gt;&lt;P&gt;I know this thread is old. But, I am attempting to do the same thing. I just can't figure out how to enter the script into the tool to be used. Any pointers?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2022 16:45:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1224770#M61458</guid>
      <dc:creator>MichaelBroderick</dc:creator>
      <dc:date>2022-10-24T16:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple attachments to a single point using Generate Match Table and Add Attachments</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1224844#M61468</link>
      <description>&lt;P&gt;You will need to enter it into the Python command window in ArcGIS Pro&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2022 19:38:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1224844#M61468</guid>
      <dc:creator>Hayley</dc:creator>
      <dc:date>2022-10-24T19:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple attachments to a single point using Generate Match Table and Add Attachments</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1225038#M61496</link>
      <description>&lt;UL&gt;&lt;LI&gt;open the Python window&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_0-1666673281751.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/54323iDD94CDF22576146E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_0-1666673281751.png" alt="JohannesLindner_0-1666673281751.png" /&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;Copy and paste the script&lt;/LI&gt;&lt;LI&gt;edit the variables at the start of the script&lt;/LI&gt;&lt;LI&gt;run with Enter&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 04:49:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1225038#M61496</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-10-25T04:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple attachments to a single point using Generate Match Table and Add Attachments</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1227880#M61809</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;,&amp;nbsp;I've tried using your script to generate an Attachment Match Table for multiple jpgs per row which I want to attach to a feature layer. I'm only returning an empty match table but not recieving any errors. I'm using a field called 'name' in the 'in_table' which matches the photo filenames in the 'photos' folder. There are approximately 6000 images in the 'photo's' folder. I'm not sure why it isn't working, do you have any advice? Thank you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;# same parameters as in the tool&lt;BR /&gt;in_table = "NFM_for_match"&lt;BR /&gt;in_folder = r"C:\GIS\photos"&lt;BR /&gt;out_match_table = r"C:\GIS\working.gdb\matchtable"&lt;BR /&gt;key_field = "name"&lt;BR /&gt;input_data_filter = "*" # eg "*.jpg"&lt;BR /&gt;relative_path = True&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;from pathlib import Path&lt;BR /&gt;# create match table&lt;BR /&gt;p = Path(out_match_table)&lt;BR /&gt;match_table = arcpy.management.CreateTable(str(p.parent), str(p.name))&lt;BR /&gt;arcpy.management.AddField(match_table, "Filename", "TEXT")&lt;BR /&gt;arcpy.management.AddField(match_table, "MatchID", "LONG")&lt;/P&gt;&lt;P&gt;# get all files that match your filter&lt;BR /&gt;in_files = list(Path(in_folder).glob(input_data_filter))&lt;/P&gt;&lt;P&gt;# for each row in in_table, get all files that match the key field or start with key field followed by "_"&lt;BR /&gt;with arcpy.da.InsertCursor(match_table, ["MatchID", "Filename"]) as i_cur:&lt;BR /&gt;with arcpy.da.SearchCursor(in_table, [key_field]) as s_cur:&lt;BR /&gt;for row in s_cur:&lt;BR /&gt;key = str(row[0])&lt;BR /&gt;for f in in_files:&lt;BR /&gt;if f.stem == key or f.stem.startswith(key + "_"):&lt;BR /&gt;fn = f.name if relative_path else str(f)&lt;BR /&gt;i_cur.insertRow([row[0], fn])&lt;/P&gt;&lt;P&gt;Thank you,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Heather&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 14:05:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1227880#M61809</guid>
      <dc:creator>HeatherBell</dc:creator>
      <dc:date>2022-11-02T14:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple attachments to a single point using Generate Match Table and Add Attachments</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1227934#M61813</link>
      <description>&lt;P&gt;Can you please post screenshots of&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;your in_table, at least the name field&lt;/LI&gt;&lt;LI&gt;the files in your photo folder, ideally showing some files that belong to the same row&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Wed, 02 Nov 2022 15:31:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1227934#M61813</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-11-02T15:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple attachments to a single point using Generate Match Table and Add Attachments</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1227997#M61819</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've attached :&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;an image of the data fields&lt;/LI&gt;&lt;LI&gt;screenshot of the photos which correspond to the field 'name'&lt;/LI&gt;&lt;LI&gt;a screenshot of the attribute table of the layer - not all fields are visible because there are a lot.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HeatherBell_0-1667410048812.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/55109iA56FD1B1A2247A25/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HeatherBell_0-1667410048812.png" alt="HeatherBell_0-1667410048812.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much.&lt;/P&gt;&lt;P&gt;Best wishes,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Heather.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 17:43:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1227997#M61819</guid>
      <dc:creator>HeatherBell</dc:creator>
      <dc:date>2022-11-02T17:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple attachments to a single point using Generate Match Table and Add Attachments</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1228080#M61828</link>
      <description>&lt;P&gt;I'm not quite sure what you're doing here... This seem to be either a modified attachment table or the attachment table joined to the feature class. And now you want to add new attachments based on the name of the attachments that are already present?&lt;/P&gt;&lt;P&gt;Anyway, the original script matches files whose names (without extension) match the key field value or start with that value followed by an underscore. Your name field includes the extension, so the script doesn't find any matching files.&lt;/P&gt;&lt;P&gt;Change line 24 of the original script:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;            key = str(row[0]).split(".")[0]&lt;/LI-CODE&gt;&lt;P&gt;This will split the value in the key field at the dot and take that first part, which is the name without extension.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 20:43:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1228080#M61828</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-11-02T20:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple attachments to a single point using Generate Match Table and Add Attachments</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1228292#M61849</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you. I tried it a different way and stripped the 'name' field of the file extension before running your script again. It still did not output a table with records. I've attached a screenshot of the error.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HeatherBell_2-1667481070268.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/55191iABD4B24F294A39A3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HeatherBell_2-1667481070268.png" alt="HeatherBell_2-1667481070268.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I've realised that if I change the field type of the 'MatchID' to text that I do output a table with the filenames and as in the screenshot. The 'MatchID' field then brings across the 'name' into the 'MatchID' field instead of a count of the matches. So I'm not sure what is going wrong here.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HeatherBell_1-1667480872360.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/55190i520340643424191B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HeatherBell_1-1667480872360.png" alt="HeatherBell_1-1667480872360.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes you are right about my table looking like a join of the feature layer and an attachment layer. This is because I have buffered a point layer to get a polygon feature class, but the operation does not support attachments. I used a script to export the attachments into the 'photo's folder from the point layer. I joined the attachment table to the polygon feature layer table to keep the details of each row in the table to each photo name in the folder because each row&amp;nbsp; might have more than one attachment. Perhaps there is a better way? I could start a new thread on this. It seems very close though now, if I can adapt your script to work, then I will be able to match the attachments back to my feature layer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Heather.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 13:13:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1228292#M61849</guid>
      <dc:creator>HeatherBell</dc:creator>
      <dc:date>2022-11-03T13:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple attachments to a single point using Generate Match Table and Add Attachments</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1228332#M61852</link>
      <description>&lt;P&gt;OK, so you have a point fc with attachments, and you want buffers with attachments, is that correct?&lt;/P&gt;&lt;P&gt;Maybe you could use what you have so far, but I'm not sure without knowing more. There could be all sorts of problems with the 1:m joins you did.&lt;/P&gt;&lt;P&gt;If possible, I'd start fresh.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Buffer the point fc&lt;/LI&gt;&lt;LI&gt;Add GlobalID to the polygon fc&lt;/LI&gt;&lt;LI&gt;Enable Attachments on the polygon fc&lt;/LI&gt;&lt;LI&gt;Use this script to copy the attachments&lt;/LI&gt;&lt;/OL&gt;&lt;LI-CODE lang="python"&gt;points = "path:/to/point_fc"
polygons = "path:/to_polygon_fc"
in_folder = "path:/to/in_folder"  # folder where the attachments are (or will be) exported


from pathlib import Path

# get a dict {GlobalID: ObjectID} for the point fc
guid_to_oid = {guid: oid for guid, oid in arcpy.da.SearchCursor(points, ["GlobalID", "OBJECTID"])}

# get a dict {OldObjectID: NewGlobalID}
oid_to_new_guid = {oid: guid for guid, oid in arcpy.da.SearchCursor(polygons, ["GlobalID", "ORIG_FID"])}

# create the match table
match_table = arcpy.management.CreateTable("memory", "MatchTable")
arcpy.management.AddField(match_table, "Filename", "TEXT")
arcpy.management.AddField(match_table, "MatchID", "GUID")

# export the old attachments and fill the match table
points_attach = points + "__ATTACH"
in_folder = Path(in_folder)
with arcpy.da.InsertCursor(match_table, ["Filename", "MatchID"]) as i_cursor:
    with arcpy.da.SearchCursor(points_attach, ["REL_GLOBALID", "ATT_NAME", "DATA"]) as s_cursor:
        for rel_gid, att_name, data in s_cursor:
            # get attachment path
            att_path = in_folder / att_name
            # export (delete this line if you already have exported)
            att_path.write_bytes(data)
            # map from old rel_globalid (points.GlobalID) to polygons.GlobalID
            old_oid = guid_to_oid[rel_gid]
            new_rel_gid = oid_to_new_guid[old_oid]
            # insert into match table
            i_cursor.insertRow([str(att_path), new_rel_gid])

# Add attachments to polygon fc
arcpy.management.AddAttachments(polygons, "GlobalID", match_table, "MatchID", "Filename")&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 03 Nov 2022 14:49:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1228332#M61852</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-11-03T14:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple attachments to a single point using Generate Match Table and Add Attachments</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1228649#M61885</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works! I will definitely have a great day and share with my team at The Rivers Trust.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much we are very grateful for your help,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Heather&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 07:40:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1228649#M61885</guid>
      <dc:creator>HeatherBell</dc:creator>
      <dc:date>2022-11-04T07:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple attachments to a single point using Generate Match Table and Add Attachments</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1292774#M69522</link>
      <description>&lt;P&gt;Hi Johannes, thank you so much for your code and solution.&lt;/P&gt;&lt;P&gt;I seem to be running into an issue where only the first few records are imported into the match table (in your example, it would be as if only 1.txt, 1_a.txt and 1_b.txt were brought in and 2.txt and subsequent were ignored).&lt;/P&gt;&lt;P&gt;Do you have any idea why this might be happening?&lt;/P&gt;&lt;P&gt;Thanks so much!&lt;/P&gt;&lt;P&gt;Amelia&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2023 19:36:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1292774#M69522</guid>
      <dc:creator>LMSID</dc:creator>
      <dc:date>2023-05-24T19:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple attachments to a single point using Generate Match Table and Add Attachments</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1292966#M69546</link>
      <description>&lt;P&gt;My guess is that your in_table is a layer that has a selection?&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2023 10:14:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1292966#M69546</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-05-25T10:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple attachments to a single point using Generate Match Table and Add Attachments</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1372116#M77639</link>
      <description>&lt;P&gt;Johannes,&lt;/P&gt;&lt;P&gt;Thanks for taking the time to answer everyone's questions. I have a layer that has multiple photos taken of a location with individual attachment columns. Please see below&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AndrewPayne_0-1705645230235.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/92140iFADE9C9C09669EA9/image-size/large?v=v2&amp;amp;px=999" role="button" title="AndrewPayne_0-1705645230235.png" alt="AndrewPayne_0-1705645230235.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The photos are all in a file location outside the gdb. I've enabled attachments. I've tried to create a match table but each time it only shows the headers and no rows underneath.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AndrewPayne_1-1705645436922.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/92142i566F4B0BB47DAF5F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AndrewPayne_1-1705645436922.png" alt="AndrewPayne_1-1705645436922.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When I attempted the python script I was getting an error&amp;nbsp;&lt;/P&gt;&lt;P&gt;File "C:\SubsurfaceMaps\ATTACHMENTS.pyt", line 13, in &amp;lt;module&amp;gt; match_table = arcpy.management.CreateTable(str(p.parent), str(p.name)) NameError: name 'arcpy' is not defined&lt;/P&gt;&lt;P&gt;Any help or insight would be very much appreciated.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 06:27:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1372116#M77639</guid>
      <dc:creator>AndrewPayne</dc:creator>
      <dc:date>2024-01-19T06:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple attachments to a single point using Generate Match Table and Add Attachments</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1372320#M77665</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;NameError: name 'arcpy' is not defined&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;The script is meant to be executed in the ArcGIS Pro Python Window, where arcpy is imported by default.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If you want to execute arcpy code outside of the Python Window (eg in custom tools or standalone scripts), you have to import arcpy first.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Your problem is a little different from the other ones in this thread. Your feature class basically already is a match table. You could probably run AddAttachments for each AttachmentField.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;To make it easier, you can transpose your table. So instead of&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;ID&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;Attachment1&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;Attachment2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;1&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;a1&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;2&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;a2&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;a3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You get&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;ID&lt;/TD&gt;&lt;TD width="50%"&gt;Attachment&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;1&lt;/TD&gt;&lt;TD width="50%"&gt;a1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;2&lt;/TD&gt;&lt;TD width="50%"&gt;a2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;2&lt;/TD&gt;&lt;TD width="50%"&gt;a3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This script will take care of the transformation, the MatchID field will contain the ObjectIDs of your fc.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;in_table = "TestPoints"
out_match_table = r"memory\match"
attachment_fields = ["TextField1", "TextField2"]


import arcpy
from pathlib import Path
# create match table
p = Path(out_match_table)
match_table = arcpy.management.CreateTable(str(p.parent), str(p.name))
arcpy.management.AddField(match_table, "Filename", "TEXT")
arcpy.management.AddField(match_table, "MatchID", "LONG")

# for each row in in_table, insert all attachment names into match table
with arcpy.da.InsertCursor(out_match_table, ["FileName", "MatchID"]) as i_cursor:
    with arcpy.da.SearchCursor(in_table, ["OID@"] + attachment_fields) as s_cursor:
        for row in s_cursor:
            oid = row[0]
            for attachment_name in row[1:]:
                if attachment_name is not None:
                    i_cursor.insertRow([attachment_name, oid])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Input fc:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_0-1705680364305.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/92217i1F17DDE6610E0B34/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_0-1705680364305.png" alt="JohannesLindner_0-1705680364305.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output match table:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_1-1705680396407.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/92218iFCA113F2B2F37313/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_1-1705680396407.png" alt="JohannesLindner_1-1705680396407.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then use that match table in AddAttachments:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_2-1705680507153.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/92220i6C787F87D3DFB632/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_2-1705680507153.png" alt="JohannesLindner_2-1705680507153.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which should attach all specified files:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_3-1705680584532.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/92221i3CCF6D0B88924305/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_3-1705680584532.png" alt="JohannesLindner_3-1705680584532.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 16:10:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-multiple-attachments-to-a-single-point/m-p/1372320#M77665</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2024-01-19T16:10:03Z</dc:date>
    </item>
  </channel>
</rss>

