I want to run a field calculation on a string field named [territory] that first looks at a string field [majr_src] to see if there is a value other than "NONE", if so [territory] = [majr_src]. If not, it looks at field [top_pct] to see if it is >30, if so [territory] is assigned the value of another string field called [Top_src]. Finally, if neither of these conditions are met it assigns [Territory] the value from a final string field called [Close_src]

I have: Pre-Logic Script Code:

def selectter(n):
 if [Majr_src] != "NONE":
  n = "[Majr_src]"
  if [Top_pct] > 30:
   n = "[Top_src]"
   n = "[Close_src]"


Territory =

any help would be greatly appreciated. *Note I am on Arc 10.1

| improve this question | | | | |

Make sure that you have set your parser to Python (as suggseted by @Arabella) and then try something more like this untested code:

Pre-Logic Script Code:

def selectter(Majr_src,Top_pct,Top_src,Close_src):
 if Majr_src != "NONE":
  return Majr_src
  if Top_pct > 30:
   return Top_src
   return Close_src

and Territory =


A key to understanding how code blocks work in the Field Calculator is learning how to use Python functions.

| improve this answer | | | | |
  • 1
    The field names should be surrounded by ! not [. I think the OP has not changed the parser to Python in the Field Calculator. – Cindy Jayakumar Oct 17 '13 at 6:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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