# Field Calculator Conditional Script

2064
2
01-06-2014 05:31 AM
by Anonymous User
Not applicable
Hi,

So I have a sewer Manhole attribute table with an "INVERT" field (measurement to the lowest pipe in manhole) fully populated with tappe down measurements. The next field over is "Invert Elevation" which has a few hundred values that have been manually calculated and entered by a contracted engineering firm from a previous watershed project (high accuracy data). Lastly, I have a DEM_ELEVATION field that has been derived from LiDAR for our city to give us elevations of manhole rims.

Now, my question is, can someone help me with the correct conditional statement to make sure I don't overwrite the values for "Invert Elevation" that are already calculated? For example

If the "INVERT" field contains a value that is not <Null>, then calculate (DEM_ELEVATION)-(INVERT)=(INVERT_ELEVATION)

Any help would be appreciated!

Thanks
Tags (2)
2 Replies
Frequent Contributor
Greg

Starting at ArcGIS for Desktop 10.1, null values in an attribute table are returned as the string 'None' in the Field Calculator using Python. Knowing this, an if/elif statement can be used to find whether values are null or not. Here is an example that checks if a field contains null values:

```if !INVERT! <> 'None':
!INVERT_ELEVATION! = !DEM_ELEVATION! - !INVERT!
```

Regards

Anthony
by Anonymous User
Not applicable
Greg

Starting at ArcGIS for Desktop 10.1, null values in an attribute table are returned as the string 'None' in the Field Calculator using Python. Knowing this, an if/elif statement can be used to find whether values are null or not. Here is an example that checks if a field contains null values:

```if !INVERT! <> 'None':
!INVERT_ELEVATION! = !DEM_ELEVATION! - !INVERT!
```

Regards

Anthony

Thanks everyone, I will let you know how it turns out!