massgis_73

Calculate Field for Zipcode values fails when there is a leading zero

Discussion created by massgis_73 on Feb 4, 2011
Latest reply on Feb 7, 2011 by niklas.norrthonesri-se-esridist
I've condensed my problem into this simplistic test sample, and I hope somebody out there can explain what is going on.

The attached zipfile contains an MXD with a table in the table of contents named "zip_table" that exists in the sample file geodatabase test_fgdb.gdb.  The source will probably need to be re-established on your end.  There is also a toolbox file named "Zipcode_Test.tbx" that should be added to ArcToolbox, and it makes use of the simplistic python in the script "test_zipcode.py".

When activated, the tool should request an input table ("zip_table" should be used in this case).  It then looks for the 'ZIPCODE' field, and populates it with a pre-defined string.  Currently this pre-defined string is set in the script as "01234".  But after running this tool, the value "668" is what ends up in the table.  The zipcode value is a string and I can't figure out why it looks like it's being converted into that new value.  Changing to "12345" returns the correct value in the table.  Adding characters instead of numbers has caused the script to bail completely.

This script was also converted and run in command line python outside of ArcGIS with the same results.

Is this a known bug with the arcpy module?  Does anybody know what the heck is going on here?

Attachments

Outcomes