<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: different names for types with arcpy.FieldList in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/different-names-for-types-with-arcpy-fieldlist/m-p/430968#M33862</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Adam, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There are at least 4 that need a conversion other than the upper case issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'SmallInteger': 'SHORT'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'Integer': 'LONG'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'Single': 'FLOAT'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'String': 'TEXT'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I agree that it is strange that you cannot simply return the field type and directly use the returned value to add a new field.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Aug 2011 14:58:40 GMT</pubDate>
    <dc:creator>JoelCalhoun</dc:creator>
    <dc:date>2011-08-24T14:58:40Z</dc:date>
    <item>
      <title>different names for types with arcpy.FieldList</title>
      <link>https://community.esri.com/t5/python-questions/different-names-for-types-with-arcpy-fieldlist/m-p/430965#M33859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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.&amp;nbsp; The code for reporting field names and types was essentially:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;fList = arcpy.FieldList(currentFC)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for f in fList:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo = f.name + ", " + f.type&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print echo&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I noticed the the field types that were reported were not what I expected (i.e. SHORT, DOUBLE, DATE etc.).&amp;nbsp; The types that were output were Integer, Smallinteger etc.&amp;nbsp; 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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there another way to get field types that produce the allowable entries for the AddField method?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Adam Slayton&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Aug 2011 14:35:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/different-names-for-types-with-arcpy-fieldlist/m-p/430965#M33859</guid>
      <dc:creator>AdamSlayton</dc:creator>
      <dc:date>2011-08-23T14:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: different names for types with arcpy.FieldList</title>
      <link>https://community.esri.com/t5/python-questions/different-names-for-types-with-arcpy-fieldlist/m-p/430966#M33860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have also run into this issue.&amp;nbsp; At first I set up a complex set of if/else statements to handle this but then someone recommended using a simple python dictionary to convert the reported type to the desired type.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;fieldTypeDictionary = {'SmallInteger': 'SHORT', 'Integer': 'LONG', 'Single': 'FLOAT', 'Double': 'DOUBLE', 'String': 'TEXT', 'Date': 'DATE'}
fldType = searchTheField.field_type
arcpy.AddField_management(updateDSParam,updateFieldParam,fieldTypeDictionary[fldType], fldPrecision, fldScale, fldLength)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope this helps, good luck.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Joel&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:22:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/different-names-for-types-with-arcpy-fieldlist/m-p/430966#M33860</guid>
      <dc:creator>JoelCalhoun</dc:creator>
      <dc:date>2021-12-11T19:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: different names for types with arcpy.FieldList</title>
      <link>https://community.esri.com/t5/python-questions/different-names-for-types-with-arcpy-fieldlist/m-p/430967#M33861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I have also run into this issue.&amp;nbsp; At first I set up a complex set of if/else statements to handle this but then someone recommended using a simple python dictionary to convert the reported type to the desired type.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;fieldTypeDictionary = {'SmallInteger': 'SHORT', 'Integer': 'LONG', 'Single': 'FLOAT', 'Double': 'DOUBLE', 'String': 'TEXT', 'Date': 'DATE'}
fldType = searchTheField.field_type
arcpy.AddField_management(updateDSParam,updateFieldParam,fieldTypeDictionary[fldType], fldPrecision, fldScale, fldLength)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;I hope this helps, good luck.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Joel&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I did that at first then realized unless it was the SmallInteger to SHORT conversion, all I needed was the str.uppper() method.&amp;nbsp; Still, this seems like a bug.&amp;nbsp; Anyone know how to report such for arcpy?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Adam Slayton&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:22:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/different-names-for-types-with-arcpy-fieldlist/m-p/430967#M33861</guid>
      <dc:creator>AdamSlayton</dc:creator>
      <dc:date>2021-12-11T19:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: different names for types with arcpy.FieldList</title>
      <link>https://community.esri.com/t5/python-questions/different-names-for-types-with-arcpy-fieldlist/m-p/430968#M33862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Adam, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There are at least 4 that need a conversion other than the upper case issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'SmallInteger': 'SHORT'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'Integer': 'LONG'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'Single': 'FLOAT'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'String': 'TEXT'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I agree that it is strange that you cannot simply return the field type and directly use the returned value to add a new field.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2011 14:58:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/different-names-for-types-with-arcpy-fieldlist/m-p/430968#M33862</guid>
      <dc:creator>JoelCalhoun</dc:creator>
      <dc:date>2011-08-24T14:58:40Z</dc:date>
    </item>
  </channel>
</rss>

