1

How do I translate the following VBScript code in Label Expression to Python using the Python-parser?

Function FindLabel ( [MHUNIT], [BLDG_NUM] )
 If Not IsNull( [MHUNIT] ) Then
  FindLabel = [MHUNIT]
 Else
  FindLabel = [BLDG_NUM]
 End If
End Function
0

1 Answer 1

1

This should do what you want:

def FindLabel([MHUNIT], [BLDG_NUM]):
    if [MHUNIT]:
        return [MHUNIT]
    else:
        return [BLDG_NUM]

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.