+ Reply to Thread
Results 1 to 6 of 6

Thread: Inconsistencies in Field type enumerations are stupid

  1. #1
    Kim Ollivier
    Join Date
    Oct 2009
    Posts
    589
    Points
    130
    Answers Provided
    10


    0

    Angry Inconsistencies in Field type enumerations are stupid

    When I do a Describe on a field in a featureclass to be able to create a foreign key in a new table you would think that the terms would match those required in AddField but they don't and the alternatives are not accepted in the tool.

    'SmallInteger' has to change to 'SHORT' and so on.
    The only way is to make up a special dictionary as a workaround

    eg dFixTypeHack = {'SmallInteger": 'SHORT',..}

  2. #2
    Jeff Christiansen
    Join Date
    Apr 2010
    Posts
    18
    Points
    0
    Answers Provided
    0


    0

    Angry Re: Inconsistencies in Field type enumerations are stupid

    I feel your frustration and share your 'angry face'

  3. #3
    Joel Calhoun
    Join Date
    Apr 2010
    Posts
    133
    Points
    32
    Answers Provided
    2


    0

    Default Re: Inconsistencies in Field type enumerations are stupid

    I agree. I've had to write a bunch of extra code to test for and set the proper item definitions, it's annoying.

  4. #4
    Curtis Ruck
    Join Date
    Apr 2010
    Posts
    43
    Points
    0
    Answers Provided
    0


    0

    Default Re: Inconsistencies in Field type enumerations are stupid

    Just another example of ESRI doing the minimum possible, never taking that extra step.

  5. 05-03-2010 02:59 PM


  6. #5
    Gus Martinka
    Join Date
    Nov 2010
    Posts
    12
    Points
    1
    Answers Provided
    0


    0

    Default Re: Inconsistencies in Field type enumerations are stupid

    Not impressed.

  7. #6
    Nobbir Ahmed

    Join Date
    Jun 2010
    Posts
    327
    Points
    124
    Answers Provided
    17


    0

    Default Re: Inconsistencies in Field type enumerations are stupid

    If you have ArcGIS 10.0 or 10.1 then you don't need to worry about keeping a dictionary. I'm on 10.0 and this code works:

    Code:
    dsc = arcpy.Describe(infc)
    
    fields = dsc.fields
    
    for field in fields:
        print field.name, field.type
        arcpy.AddField_management(infc2, field.name, field.type)
    Although the print statement shows the field type to be SmallInteger - internally it is made consistent with Short type.

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts