Hey all,
I understand I can use FieldName!.upper() to make one field upper case. Is there an equally easy way to make this apply to all fields simultaneously rather than applying this one field at a time?
You can use Calculate Fields to do multiple calculations in one pass.
Can you elaborate? I see you linked out to the Calculate fields Documentation but I'm not sure how to apply that to my current use case. It looks like most of the examples are pulling multiple fields to calculate one field where I just need to Capitalize all fields. Sorry pretty new to python and such so still deep in the learning curve...
The tool lets you pick multiple fields to run calculations on, so you can add every field you want to capitalize and then set each expression to be !That_Field!.upper().
If you want to do this with Python you can use an Update Cursor, play around with that on your test data and you should get good results.
Something like the following should work or get you close:
tbl = # full path to table or feature class
text_fields = [
field.name
for field
in arcpy.Describe(tbl).fields
if field.type == "String"
]
with arcpy.da.UpdateCursor(tbl, text_fields) as cur:
for row in cur:
row = [
item.upper() if item else None
for item
in row
]
cur.updateRow(row)