Adding an attribute index using the OBJECTID field?

887
2
11-21-2013 06:05 AM
AleydisG__Pere
Occasional Contributor
Through the Properties dialog of any (file/personal geodatabase) feature class I can add an attribute index using the OBJECTID field.
But when trying to do the same using the Add attribute index tool, the OBJECTID field is not listed in the dialog and it won't let me use it.
Is there anything I'm doing wrong?
0 Kudos
2 Replies
RussellBrennan
Esri Contributor
You are not doing anything wrong. The tool dialog filters out the OBJECTID field from the list of available fields because it is indexed by default.  If you wish to create a composite index using OBJECTID and another field you can use python to execute the tool. When executed via python the tool will allow you to specify this field.

For example:
arcpy.AddIndex_management("Database Connections/testDB.sde/russell.TEST.TestPoints","OBJECTID;FIELD1","compositeTest","NON_UNIQUE","NON_ASCENDING")


Hope this helps
0 Kudos
AleydisG__Pere
Occasional Contributor
The problem is that I have some personal geodatabases with feature classes which do not have the OBJECTID field indexed.
Using Python I can find those fcs in my geodatabases. The next step in my script would be indexing the OBJECTID field but it won't let me. I get a '000308 : Invalid field type' error.

Isn't there any other way to add the OBJECTID index programmatically? Upgrading the geodatabase to the latest version will not fix this.
0 Kudos