I'm trying to use the Field Calculator (python) to replace existing values (string) in Field1 with the values in Field2 (string) but only if Field2 is not Null.
Having trouble with the syntax.
Thanks,
John
Solved! Go to Solution.
John,
In Field Calculator you will want to create a def statement in the code block and pass the values of Field1 and Field2 to this statement. The Statement will look something like the following:
def checkValue(f1, f2):
if f2 is None:
return f1
else:
return f2
You would call the function using:
checkValue(!field1!, !field2!)
John,
In Field Calculator you will want to create a def statement in the code block and pass the values of Field1 and Field2 to this statement. The Statement will look something like the following:
def checkValue(f1, f2):
if f2 is None:
return f1
else:
return f2
You would call the function using:
checkValue(!field1!, !field2!)