Select to view content in your preferred language

'Text' vs 'String' keyword for field attribute creation and description

9021
2
Jump to solution
08-23-2017 06:36 AM
GeorgeNewbury
Frequent Contributor

Any idea why the input requirements for adding a string/text field is different than the 'type' attribute for a string/text field?

For example:

----

myfc  =  r'C:\Foo\bar.gdb\somefc'

arcpy.AddField_management(myfc, 'MyStringField', 'TEXT',5)

myfc_pyobject = arcpy.ListFields(myfc,'MyStringField')[0]

------

myfc_pyobject.type would print out 'String'

Seems like they should be the same.

Thanks

George

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JoshuaBixby
MVP Esteemed Contributor

Consistency would be great, but this is covered/addressed in the Field—Help | ArcGIS Desktop :

The field type.

  • Blob —Blob
  • Date —Date
  • Double —Double
  • Geometry —Geometry
  • GlobalID —Global ID
  • Guid —Guid
  • Integer —Integer (Long Integer)
  • OID —Object ID
  • Raster —Raster
  • Single —Single (Float)
  • SmallInteger —Small Integer (Short Integer)
  • String —String (Text)

Similar/same data types aren't always called the same thing in different systems, and ArcGIS has to balance data type names between ArcObjects, Python, DBMSs, etc....  I think "string" is more common in programming languanges but "text" is more user friendly.

View solution in original post

2 Replies
JoshuaBixby
MVP Esteemed Contributor

Consistency would be great, but this is covered/addressed in the Field—Help | ArcGIS Desktop :

The field type.

  • Blob —Blob
  • Date —Date
  • Double —Double
  • Geometry —Geometry
  • GlobalID —Global ID
  • Guid —Guid
  • Integer —Integer (Long Integer)
  • OID —Object ID
  • Raster —Raster
  • Single —Single (Float)
  • SmallInteger —Small Integer (Short Integer)
  • String —String (Text)

Similar/same data types aren't always called the same thing in different systems, and ArcGIS has to balance data type names between ArcObjects, Python, DBMSs, etc....  I think "string" is more common in programming languanges but "text" is more user friendly.

GeorgeNewbury
Frequent Contributor

Thanks, I've probably seen that part of the help 100s of times but never actually digested the 'String to TEXT' part in the note.

Thanks

George

0 Kudos