I have a feature class and I need to know the ObjectID of its last record.
What is the best way to find out last ObjectID?
Opening a search cursor and reading all the records is one way, but is there any other way?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityI have a feature class and I need to know the ObjectID of its last record.
What is the best way to find out last ObjectID?
Opening a search cursor and reading all the records is one way, but is there any other way?
To do this I would use the Summary Statistics (Analysis) tool and this statistic type on ObjectID:
MAX—Finds the largest value for all records of the specified field.
Then if you want to read the MAX (highest) value you can use a search cursor on its output table to open and read the one record therein.