AnsweredAssumed Answered

Add Path to JPGs in Attribute Table based on Unique ID

Question asked by jpilbeam Champion on Mar 19, 2019
Latest reply on Mar 21, 2019 by jpilbeam

I've been tasked with updating attribute table fields with file paths to image files in a folder based on a unique ID. I'm having trouble thinking up a script that will do this? I'm working on a standalone script in ArcGIS Pro 2.3.1 Arcpy. 


This is an example of how the table should look. Every JPG has a unique ID that matches the Post_Number field unique ID. Currently, the paths to the JPGs are entered manually into the table, and there are 1000s of them.


All I've done so far is create a cursor that searches the Post_Number and Photo fields. 

import arcpy, os

fc = r'pathto\Projects\DOT_SignInventory\Data.gdb\WCDOT_Signs'
fields = ['Post_Number', 'Photo']

    with arcpy.da.SearchCursor(fc, fields) as cursor:
        for row in cursor:
            print(u"{0}, {1}".format(row[0], row[1]))