Using ArcGIS 10.2.2

In the picture below, I want to populate the Spd_Class field (short integer). The value of the Spd_Class attribute will be based on the TYPE field -

residential = 30 secondary = 35 primary = 50

is there a quick way to use the text field in TYPE to populate Spd_Class? I've been unable to think of a way to do this.

enter image description here

1 Answer 1


In your Field Calculator, have the python parser enabled. You can do some neat things with the Field Calculator. I suggest checking out the Field Calculator Unleashed from ESRI for a bit of a code introduction to the Field Calculator. Then check out their documentation for more advanced ideas.

I am using lower() and strip() in case there are values that don't conform.

In the Pre-Logic part enter:

def myFunct(input):
  if input.lower().strip() == "residental":
    return 30
  elif input.lower().strip() == "secondary":
    return 35
  elif input.lower().strip() == "primary":
    return 50

In the bottom part, Spd_Class =



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.