Is This Content Helpful?
We're glad to know this article was helpful.
These instructions provide examples of VBScript and Python syntax that show a way to calculate fields where some input values are null.
Be aware that the Python form of the script produces the expected results on 10.1, but on 10.0 does not return a value for null inputs. VBScript produces the correct results on both versions.
The calculation in each case applies the source value (in this case, the field Dbl1 or Dbl2) to the target field unless the source is null, in which case the target field is assigned the value zero.
1) Copy and paste the following sample into a Notepad file and save it with a .cal extension.
2) Load the .cal file into the Field Calculator to calculate the desired target field, setting the parser to VBScript. Substitute the desired field data source for field ‘Dbl1’ in the sample.
if IsNull ([Dbl1]) then
X = 0
X = [Dbl1]
def X (param):
retVal = 0
if param is not None:
retVal = param