[GIS] Label Expressions to replace null values with text not in feature class

arcmaplabeling

I need to label some hydrants (points) – some of these belong to the fire brigade and have a number assigned to them, some do not and thus do not have a number. I would like to write an expression along the lines of:

'Label Hydrant with number if number exists, if hydrant has null value label with 'WO'.'

I just can't figure it out.

The simplest way for me to do this would be to change the null values to WO but the data is not mine, and I do not want to make changes to it. I suppose I could make a copy and put the values in the copy, but ideally I would like an expression.

Thanks!

Best Answer

You can use a simple script like this to label the features with Null values.

Function FindLabel ( [yourfield] )
  if isnull( [yourfield]) then
    FindLabel = "WO"
  else
    FindLabel = [yourfield]
  end if
End Function