Finding the original Object Id in a FC using Python

695
1
Jump to solution
10-17-2016 11:46 PM
MANESK
by
New Contributor III

My feature class consists of several fields with name as Objectid,Objectid_1,objectid_2,objectid_12 due to spatialjoin and exporting..
I require only the recent object Id and delete all other fields..How to find and execute in arcpy!!!!

0 Kudos
1 Solution

Accepted Solutions
JoshuaBixby
MVP Esteemed Contributor

You could guess OBJECTID, and likely be correct, but you can find out definitively by using the ArcPy Describe object:

>>> table = # table or feature class
>>> desc = arcpy.Describe(table)
>>> desc.OIDFieldName
u'OBJECTID'
>>> 

View solution in original post

1 Reply
JoshuaBixby
MVP Esteemed Contributor

You could guess OBJECTID, and likely be correct, but you can find out definitively by using the ArcPy Describe object:

>>> table = # table or feature class
>>> desc = arcpy.Describe(table)
>>> desc.OIDFieldName
u'OBJECTID'
>>>