# Using Null values in Field Calculator

I have a python script in the field calculator that reads dates and populates a status field. When there is an empty value in the "actual" field, that is the status of the project. Here is the code that I use:

``````def cal(rec_a, soc_a, stk_a, plat_a, perm_a, per_a, status):

if rec_a == " ":
return "Field"

elif soc_a == " ":
return "Consult"

elif stk_a == " ":
return "Stake"

elif plat_a == " ":
return "Plat"

elif perm_a == " ":
return "Permit"

elif per_a == " ":
return "Waiting"

elif (per_a is not None) or (per_a == " "):
return "Permit Rec"
``````

And the expression is:

``````cal (!Recon_act!, !SOcons_act!, !Stake_act!, !Plat_act!, !permit_act!, !PerRec_act!, !status!)
``````

How do I use that same expression, but instead of reading empty fields it reads Null values?

``````if rec_a IsNull: ?

if rec_a == Null: ?
``````
• It is None to be used, e.g. B!=None Sep 12, 2016 at 20:04
• if rec_a == None: Sep 12, 2016 at 20:07
• you should learn how to use the arcpy.da.UpdateCursor and arcpy.da.InsertCursor cursors to update/add/insert rows and columns. its quicker and more intuitive than the clunky field calculator Sep 12, 2016 at 20:13
• elif rec_a is None: gis.stackexchange.com/questions/78787/… Sep 12, 2016 at 20:37

You can create a list and check if your value exists in that list. Place your possible Null/empty/spaced values into that list and check them all at once.

``````def findnulls(fieldname):
if rec_a in [None, "", " "]:
return "Field"
``````

`None` is the python keyword for Null.

If you want to find Nulls separate to empty values, use `is None`

``````if rec_a is None:
return "value is Null!"
elif rec_a == " ":
return "value is single space!"
elif rec_a == "":
return "value is empty!"
``````