AnsweredAssumed Answered

Acquire ObjectId value of inserted row

Question asked by jamesfreddyc on Jan 30, 2018
Latest reply on Jan 31, 2018 by bixb0012

Using arcpy.da.InsertCursor, what is the best way to capture the ObjectId value of the row that was just inserted?

 

with arcpy.da.SearchCursor(finalFC, fieldnames, 'OBJECTID = {}'.format(oid)) as fscur:
       for fsrow in fscur:
           with arcpy.da.InsertCursor(scratchFC, fieldnames) as icur:
               icur.insertRow(fsrow)
               #I need to capture the OBJECTID value of the row that was just inserted in the line above
       del icur

Outcomes