0

I'm trying to add some functionality to an ArcPy toolbox to check the column names and types of an input feature class.

It seems that the types that Python uses are different from the types in ArcMap itself?

For example, a column of type float in the layer properties menu in python is type Single

for the other column types:

Text: String,
Long:Integer,
Short:SmallInteger

I haven't found a reference for the full universe of options only this documentation and there's no mention of this distinction in the docs for ListFields, it just uses the Python types, with no mention of the difference between Python and ArcMap.

is there a better way to be working with field types than by name like this? Is there documentation on this that I haven't found?

4
3

Add Field has a list too. I don't think there is a page mapping parameter types. As you are developing an arcpy toolbox, stick to the naming conventions used in the geoprocessing tools as they only accept those. You just have to assume that your users are savvy enough to realise "Text" is "string" and vice versa.

If you want to help your users then I suggest editing the item description of the tool you are developing and provide help along with each parameter.

1
  • 1
    yeah actually, that's part of what I'm struggling with as the list in AddField uses the arcmap data types, not the data types from ListFields. I think if I was a user of the tool, I would expect text vs. string to be a meaningful distinction of some sort because why else would there be a difference. I might just make a dict to handle the difference in the warning message strings. Jan 27 '21 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.