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 that you have read and understand our privacy policy and code of conduct.

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