1

Not sure what I am doing wrong. The expression is valid, but the results are that nothing labels at all. This is the function:

Function FindLabel ( [Address], [Building], [Unit] )

If (IsNull[Unit]) And (IsNull[Building]) Then
          FindLabel = [Address]

ElseIf (Not IsNull[Building]) And (IsNull[Unit]) Then
          FindLabel = [Address] + vbNewLine + [Building]

ElseIf (IsNull[Building]) And (Not IsNull[Unit]) Then
          FindLabel = [Address] + vbNewLine + [Unit]

End If

End Function
1
  • 1
    what if both Unit and Building is present? Your function would do nothing for this case
    – prusswan
    Commented Jun 29, 2023 at 19:17

1 Answer 1

1

It's been a very long time since I used VBScript, but I think IsNull is a function so should use parentheses, i.e. IsNull([FIELD]) instead of IsNull[FIELD].

You should also add an Else clause for when both fields contain values.

Also, check you have actually enabled labels. Right click layer and check the "Label" menu entry is highlighted with a box around its icon. Label is directly above the Labelling Properties... entry.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.