AnsweredAssumed Answered

Replace Null Value - Field Calc, Python

Question asked by Keith.SoRelle_CFW on Oct 1, 2018
Latest reply on Oct 1, 2018 by Keith.SoRelle_CFW

Trying to replace a null value with the field calculator. I am have a script that appends multiple feature classes into one feature class. After each feature class appends I want to add a field calculateField_management (field calculator) statement run that makes all null values from a specific field into a string value. 


I've tried a number of ways but have yet to get an expected result. 


I have 2 values for in the field - Null, 'CFW' and need to replace Null with 'TAR'.

Then I will have 3 values - Null, 'CFW', 'TAR' and will need to replace Null with 'DEN'


I've been trying something along the lines of:


def myCalc(x)

      if (x != 'CFW"):

         return 'TAR'


      return 'CFW'




Should be simple but I haven't had much luck getting the expected response. Could use help on both field calculations.