0

I work with ArcGIS Desktop (latest version). I have a feature class called "space" that should be labeled. The label should look like this [room number] + "/ n" + [person] (python). But my problem is not that every room is assigned to a person like a toilet or laboratory. If there is a room that no one owns, the room should only be labled with the room number, but this is not the case. There is no label.

How I tried to do it :

def FindLabel ( [room_number],[person] ):
  if [person] ="<Null>":
    return  [person] + '\n' +[Raum_Nummer]
  else:
    return [Raum_Nummer]

"< Null >" is my default value

1 Answer 1

1

You can use either if [person] is not "" or if [person] != "" and they should work. Also, under the if/else statements, it should be [room_number] not [Raum_Nummer], or at least you need to unify the variables either [room_number] or [Raum_Nummer]. Do not forget to to check advance labeling to enable carriage return.

Try the following:

def FindLabel ([room_number],[person]):
    if [person] is not "":
        return  [person] + '\n' + [room_number]
    else:
        return [room_number]
2
  • I tried it but ther is an erro : Carriage returns are not allowed in simple expressions Commented Apr 10, 2020 at 11:13
  • 1
    You need check advance labeling to enable carriage return.
    – ahmadhanb
    Commented Apr 10, 2020 at 11:29

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.