def FindLabel ( [field 1] , [field 2] ): if [field1] != "": return [field1] return [field2]
def FindLabel ( [FIELD1], [FIELD2] ): if [FIELD1] == "": return [FIELD2] elif [FIELD2] == "": return [FIELD1] else: return ""
Are you trying to label an expression from with an arcpy script or as a Label Expression inside an ArcMap session?
If you're doing this within ArcMap, you'd need to use the Advanced Python Label Expression window and use a function something like this:def FindLabel ( [field 1] , [field 2] ): if [field1] != "": return [field1] return [field2]
Hi there,
this results in only displaying field 2...
Any other suggestions?
thank you very much for your help!
JB
if [field1].strip() != "" AND NOT [field1] Is None: or maybe you could use: if len([field1].strip()) > 0: