Select to view content in your preferred language

Using Calculate Field in python?

1732
20
01-06-2011 08:18 AM
BartłomiejStaroń
Occasional Contributor
The tool works well in the MODEL bilder, but when it wants to convert it to the python script error occurs. All data from the column disappear.



import arcgisscripting
gp = arcgisscripting.create(9.3)
gp.workspace = "D:\\DATA.gdb\\"
TABLE = "D:\\DATA.gdb\\TABLE"
FIELD = "texx"

gp.CalculateField_management("TABLE", "FIELD", "StrConv([texx],vbUpperCase)", "VB")



What am I doing wrong??
0 Kudos
20 Replies
ChrisSnyder
Honored Contributor
Yes, but perhaps there is a case for some of these different methods of capitalizing the 1st letter in each word. I often find that many "out of the box" solutions don't do exactly what I want them to do. Just to be on the Devil's side...

>>> print "1234 can't st".title()
1234 Can'T Street

Pretty much any grammatical contraction (like "can't") and even some colloquialism (like "ain't" and "y'all") would suffer at the hands of any algorithm that assumed the letter following an apostrophe should be capitalized. In addition, many place names in the U.S. often have non-English derivations for example: Coeur d'Alene, Idaho (Bad Example, But Y'All Get My Drift).
0 Kudos