I'm trying to replace the text in a field to build a label expression. The field I'm using is called [Organizatio] and it holds the school's name. What I want is to tell ArcMap that when that name includes 'Central School District' - change it to "CSD."

This is what I have. ArcMap says it's valid but it does not make any changes.

enter image description here

  • 2
    You need to define the function without the field name in code block, in the bottom block you can use the function as FindLabel(!Organizati!). Check documentation for more information
    – aldo_tapia
    May 9, 2018 at 18:14
  • I'm not sure I understand what you're telling me. I'm doing this in the label expression window. Parameters have to be passed as shown.
    – Tory
    May 10, 2018 at 18:52

1 Answer 1


As I mentioned in commentaries:

Use in pre-logic script code block:

def FindLabel(field):
  string = field
  newstring = string.replace('Central School District ', 'CSD ')
  return newstring

In field definition (test2 is the object field):

FindLabel( !test2! )

enter image description here


enter image description here

test1 and test2 had the same values initially

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.