Arcpy AddIndex_management won't index long text fields, is there a workaround?
I tried:
arcpy.AddIndex_management(r'C:\workspace\foo.dbf', "Text")
and got the error:
Runtime error Traceback (most recent call last): File "<string>", line 1, in <module>
File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\management.py", line 5993, in AddIndex
raise e ExecuteError:
ERROR 999999: Error executing function.
Attribute indexes cannot be created for fields with a length that is greater than 80.
Failed to execute (AddIndex).
I have also tried this with shapefiles as well as dbf's with the same error. I need to index a text field in order to perform a JoinField() more quickly with arcpy.
Is there a work around to do this that doesn't involve shortening text fields?
I haven't seen a reason not to index fields longer than 80 characters; especially since the text fields I'm indexing have been calculated and are therefore not very prone to typos. For example, if you had a series of field of species names and you wanted to join that to a table containing descriptions of those species, you would be joining on a potentially long text string.