Where Expression

2616
2
Jump to solution
09-26-2014 08:48 AM
PamFoster
New Contributor

Hi-

 

I'm trying to label a field using an expression.

 

I want the attribute to be labeled with field x except when field x equals "other" than I want it to be labeled with field y.

 

I don't know how to write the code/expression.

 

Any help would be appreciated, thanks!

Kait

1 Solution

Accepted Solutions
JakeSkinner
Esri Esteemed Contributor

Hi Kaitlyn,

Here is an example on how to do this using the Python parser:

def FindLabel ([FIELDX], [FIELDY] ):

  if  [FIELDX] == 'other':

    return [FIELDY]

  else:

    return [FIELDX]

Below is a screen shot of the Label Expression dialog:

screen1.png

View solution in original post

2 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Kaitlyn,

Here is an example on how to do this using the Python parser:

def FindLabel ([FIELDX], [FIELDY] ):

  if  [FIELDX] == 'other':

    return [FIELDY]

  else:

    return [FIELDX]

Below is a screen shot of the Label Expression dialog:

screen1.png

View solution in original post

PamFoster
New Contributor

Thanks! That worked!

0 Kudos