If I understand correctly, you want to take an integer field and do some calculations and change the field to a text field, correct?
You cannot do that in the field calculator. However, you can do it in the python window. You would be adding another field, moving and converting values, and then deleting and replacing your GRIDCODE field with another that is text. Be sure you back up before you do anything in case there is an error in my code or your copying. Double check the parameters for the arcpy function as it is coming from my memory.
Update Cursor: http://resources.arcgis.com/en/help/main/10.1/index.html#//018v00000064000000
Add Field: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//001700000047000000
Delete Field:
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//001700000052000000
What you would be looking to do would be something like this:
arcpy.AddField_management("TempField", "TEXT") #create a temp field to hold text values
rows = arcpy.UpdateCursor("YOURLAYER") #create an update cursor to convert and move values
for row in rows: #set an iteration for your rows
row.TempField = str(row.GRIDCODE) #copy the value over
rows.updateRow(row) #tell the cursor to update
arcpy.DeleteField_management("GRIDCODE") #remove your integer field
arcpy.AddField_management("GRIDCODE", "TEXT") #create another one with text
#mind you, this moves the field all the way to the right
rows = arcpy.UpdateCursor("YOURLAYER") #create a second update cursor
for row in rows: #set up another iteration
if row.TempField == "1": #if statement for assignment
row.GRIDCODE = "BSM"
elif row.TempField == "3":
row.GRIDCODE = "BSW"
elif row.TempField == "4":
row.GRIDCODE = "BSP"
else:
row.GRIDCODE = "None"
rows.updateRow(row) #update your new text row
arcpy.DeleteField_management("TempField") #clean up the temporary field
GRIDCODE
is coming from is numeric (or both)? – Evil Genius Jun 25 at 14:05GRIDCODE
and the fieldGRIDCODE
comes from a reclassified Rasterfile and is numeric. Now I want to change values (all of them) from the fieldGRIDCODE
to stringvalues in die fieldGRIDCODE
. All is suppose to happen in one field. – Stophface Jun 25 at 14:07