fjscott

Error running field calculator

Discussion created by fjscott on Jul 12, 2011
Latest reply on Jul 18, 2011 by tlsilveus
I am attempting to copy over values from a string field to an integer field. In the case of an empty string, I want to make the value null but am getting the following error:

ERROR 000539: Error running expression: getDOT( " ") <type 'exceptions.NameError'>: global name 'null' is not defined
Failed to execute (Calculate Field (7))

The code block that I am using the field calculator is:

def getDOT(dot):

  if (len(dot) > 1):
    result = int(dot)
  else:
    result = null

  return result


Is it possible to set integer field to a null value? I have done it in the past, but cannot seem to get it to work now.

Thanks,

jeremy

Outcomes