spencermeyer

Field Calculator - Python logic problem

Discussion created by spencermeyer on Apr 13, 2011
Latest reply on Apr 14, 2011 by tlsilveus
Hello,

I'm trying to calculate a new field based on values in two other fields. My codeblock is:
def SRMConsType(Howdy,Doody):
  if (Howdy == "FED" or Howdy =="STP" or Howdy == "LOC"):
    return "Public"
  elif (Howdy == "FED" and Doody == "E")  or (Howdy =="STP" and Doody == "E") or (Howdy == "LOC" and Doody == "E"):
    return "Public w/ Easement"
  elif (Howdy == "PNP"):
    return "Non-Profit"
  elif (Howdy == "PFP" or Howdy =="PLO"):
    return "Private w/ Easement"
  elif (Howdy == "TRB" or Howdy =="UNK"):
    return "Other"

and my expression is:
SRMConsType( !FEE_ORGTYP!,!INT_TYPE!)


I think it's my use of "and" and "or" that is causing grief but I'm not sure the best approach to find each case and return the correct value. I also tried grouping the "ors" in () and putting the "ands" between them but that didn't work either.

Please help this python NOOB!

Outcomes