AnsweredAssumed Answered

How do you get Field Calculator to recognize spaces in a text field?

Question asked by luke.haskett on Aug 7, 2017
Latest reply on Aug 7, 2017 by Dan_Patterson

Hi!

 

I'm trying to run a field calculator statement to fill an integer field based on a preceding text field - so depending on what the text is, a certain number will be assigned to it. However, the field calculator statement I'm using only seems to work if the text has no spaces in it... any help with this would be greatly appreciated!

 

The expression is:

Reclass(!Typology!)

And the code black is:

def Reclass(Typology):
   if Typology is "Allotments":
      return 0.30
   elif Typology is "Amenity Green Space":
      return 0.40
   elif Typology is "Park and Recreation Ground":
      return 1.65

etc.

 

However, in the example above, only allotments will be assigned the requested number. If I removed the spaces from the other text, the calculation works but this isn't acceptable for what I need.

 

Many thanks in advance.

 

Luke

Outcomes