Dear Xander Bakker,
Please find the attached for the my pgdb.
I am still getting some error from the script you have sent me. please advise. thanks
I have a geodatabase with multiple feature classes in multiple feature datasets. Each feature class has same fields which are identical and will carry the same value. plzhelp me.
I have fields in the below.
BUILDING_ID
COMMENT
DISCIPLINE_CODE
DRAWING_REFERENCE
FLOOR_ID
OWNERSHIP_CODE
PARCEL_ID
SUBDISCIPLINE_CODE
- import arcpy
- import os
- import sys
-
-
- arcpy.env.overwriteOutput = True
-
-
- ws = r"D:\Xander\GeoNet\MultiAttsUpdate\gdb\Sample.gdb"
-
-
- building_id = 'your building id'
- comment = 'your comment'
- discipline_code = 'your discipline code'
- drawing_ref = 'your drawing reference'
- floor_id = 'your floor id'
- ownership_code = 'your ownership code'
- parcel_id = 'your parcel id'
- subdiscipline_code = 'your subdiscipline code'
-
-
- dct_fld_val = {'BUILDING_ID': building_id,
- 'COMMENT': comment,
- 'DISCIPLINE_CODE': discipline_code,
- 'DRAWING_REFERENCE': drawing_ref,
- 'FLOOR_ID': floor_id,
- 'OWNERSHIP_CODE': ownership_code,
- 'PARCEL_ID': parcel_id,
- 'SUBDISCIPLINE_CODE': subdiscipline_code}
-
-
- flds_upd = dct_fld_val.keys()
-
-
- arcpy.env.workspace = ws
- fds = arcpy.ListDatasets(feature_type='Feature')
- fds.append('')
- for fd in fds:
- fcs = arcpy.ListFeatureClasses(feature_dataset=fd)
- for fc in fcs:
-
- fc_pathname = os.path.join(ws, fd, fc)
- flds_fc = [fld.name for fld in arcpy.ListFields(fc_pathname)]
- flds = list(set(flds_upd) & set(flds_fc))
-
-
- with arcpy.da.UpdateCursor(fc_pathname, flds) as curs:
- for row in curs:
- for fld in flds:
- row[flds.index(fld)] = dct_fld_val[fld]
- curs.updateRow(row)
Thanks
Santhosh