I am trying to calculate a field based on whether another field is filled or null using python. I'm open to Arcade or SQL too. What I want to do is "If the Inspector field is filled, then calculate the Completed field as 'Flushed'. If the Inspector field is <Null>, then calculate the Completed field as 'Not Flushed'." Here is my code so far. The issue is that it is calculating everything as 'Flushed'.
def reclass(Inspector):
if(Inspector=="Alan Covington" or "Braxton Lawrence" or "Dave Besler"):
return "Flushed"
else:
return "Not Flushed"
Solved! Go to Solution.
#Another option: This does work
def reclass(Inspector):
if(Inspector == "Alan Covington" or Inspector =="Braxton Lawrence" or Inspector == "Dave Besler"):
return "Flushed"
else:
return "Not Flushed"
"in"
if(Inspector=="Alan Covington" or "Braxton Lawrence" or "Dave Besler"):
if(Inspector in ["Alan Covington", "Braxton Lawrence", "Dave Besler"]:
peeps = ["Alan Covington", "Braxton Lawrence", "Dave Besler"]
Inspector = "Dave Besler"
Inspector in peeps
True
#Another option: This does work
def reclass(Inspector):
if(Inspector == "Alan Covington" or Inspector =="Braxton Lawrence" or Inspector == "Dave Besler"):
return "Flushed"
else:
return "Not Flushed"
This worked. Oddly, the data was reading the field slightly differently when it came to the inspectors' names, and your addition helped. Thank you
def reclass(Inspector):
if(Inspector=="Besler" or Inspector=="Covington" or Inspector=="Lawrence B"):
return "Flushed"
else:
return "Not Flushed"