agslayton

different names for types with arcpy.FieldList

Discussion created by agslayton on Aug 23, 2011
Latest reply on Aug 24, 2011 by Stringtheory
I recently created a python script that iterates through a directory, identifies all feature classes within a directory, ids all fields within the FC, and outputs the the name of the fields and the type of the field.  The code for reporting field names and types was essentially:

fList = arcpy.FieldList(currentFC)

for f in fList:
     echo = f.name + ", " + f.type
     print echo
    
I noticed the the field types that were reported were not what I expected (i.e. SHORT, DOUBLE, DATE etc.).  The types that were output were Integer, Smallinteger etc.  My ultimate goal is to add a field to a feature class with the same name and type as what I found, but the reported types are not allowed as the required field_type parameter in the arcpy.AddField_management method.

Is there another way to get field types that produce the allowable entries for the AddField method?

Thanks,

Adam Slayton

Outcomes