Field Calculator

Discussion created by kwaal on Dec 3, 2013
Latest reply on Dec 4, 2013 by msayler
I'm trying to clean up some tables with the field calculator using python. Python is new to me so I'm not sure if it's possible. It would be nice if someone could post any page that can provide me with pytonsyntax for the field calculator.

This operation will only contain of cleaning up one field in each table. I want the field calculator to convert the records with
'x' to a NULL(None) value. There are also records with other strings too. I guess I will need if statement to convert other strings.

So how to make 'x' = NULL ?
Is it possible to convert all the strings to NULL values, not specifying the actual string?

I tried this:

def CleanField(InValue):
     if InValue = 'x'
         result = None
     if InValue = 'y'
         result = None
     elif Invalue = Int
         result = InValue
     return results

All the records in the field where converted to NULL(None).

Just to mention it, the other values are numbers.