AnsweredAssumed Answered

Remove Empty Spaces with Field Calculator

Question asked by narcher on Aug 1, 2017
Latest reply on Aug 1, 2017 by narcher

Hi,

 

I have a fields that is populated with correct values, <Null>, and whitespace/empty. The field is of text value with both numbers and letters in the correct values. I want to remove all of the whitespace/empty and replace them with <Null> instead. I am trying to do this with the field calculator and python.

 

My current prelogic statement is:

def makeNull(unitType):
  if unitType == str():
    return None

 

And the box below is: 

makeNull( !UnitType!)

 

However when the field is calculated it turns all of the values to <Null> instead of just the whitespace/empty. Any Idea what I am doing wrong?

Outcomes