[GIS] Auto populate field with text using field calculator if/then

arcgis-desktopfield-calculator

I've extracted values from a raster to a point file, but now I need a field with the text information from the raster attribute table that corresponds with the value. I've been trying to use the field calculator to do an if/then type function, but I can't get it to work;enter image description here
Basically, where it says 1201 in the RASTERVALU field I want it to say "Developed, Open Space" in the CN_LEVEL3 Field. I have absolutely no experience with Python.

Best Answer

In your field calculator, select Python as your parser. In your code block:

def calcVal (inVal):
 if inVal == 1201:
   return "Developed, Open Space"

Then in your field calculation box:

calcVal(!RASTERVALU!)

Tweak as needed. Look into if/elif/else statements for a bit more complex logics.

Related Question