AnsweredAssumed Answered

What can I use instead of OBJECTID?

Question asked by ionarawilson on Oct 10, 2013
Latest reply on Oct 10, 2013 by ionarawilson
This code works if I use the FFY fifeld to get the value of the field, but I really need to get the value of the OBJECTID, but it does not work when I use OBJECTID. What value should I use to get the OBJECTID? This data is in SDE. Thanks



fieldmappings = arcpy.FieldMappings() fieldmappings.addTable(Input_Polygons) fieldmappings.addTable(Counties)  # create output feature for spatial join outstewardshipcounties = os.path.join(arcpy.env.scratchGDB, "StewardshipCounties")  #run spatial joint tool  arcpy.SpatialJoin_analysis(Input_Polygons, Counties, outstewardshipcounties , "#", "#", fieldmappings, "HAVE_THEIR_CENTER_IN")  #create dictionary  path_dict = { } rows = arcpy.SearchCursor(outstewardshipcounties) for row in rows:     keyrow = row.getValue("FFY")     valrow = row.getValue("FIPS_TXT")     path_dict[keyrow] = valrow  urows = arcpy.UpdateCursor(Input_Polygons) for urow in urows:     upkey = urow.getValue("FFY")     if upkey in path_dict:         urow.setValue("County", path_dict[upkey])         urows.updateRow(urow) del row, rows, urow, urows

Outcomes