Hi everyone,

I'm trying to define an expression for labeling parcel polygons in ArcMap. The feature class has 3 attributes of interest: CATEGORIA, NUM_CATASTRO, and PARCEL_SP. If CATEGORIA (integer field with subtypes defined) is not 0 (N/A), then label the polygon with the value in PARCEL_SP, otherwise label with NUM_CATASTRO. I'm not a programmer and I'm just starting with Python so I'm not sure what is missing. So far I have...

def FindLabel ( [CATEGORIA],[NUM_CATASTRO], [PARCEL_SP] ): if [CATEGORIA] ==0: return [PARCEL_SP] else: return [NUM_CATASTRO]

The issue is that I can see labels for NUM_CATASTRO where they should, but none for PARCEL_SP.

If I reverse the values...

def FindLabel ( [CATEGORIA],[NUM_CATASTRO], [PARCEL_SP] ): if [CATEGORIA] ==0: return [NUM_CATASTRO] else: return [PARCEL_SP]

it labels the PARCEL_SP where is supposed to but not the NUM_CATASTRO.

Same thing using the following statement...

def FindLabel ( [CATEGORIA],[NUM_CATASTRO], [PARCEL_SP] ): if [CATEGORIA] !=0: return [PARCEL_SP] else: return [NUM_CATASTRO]

Any help will be appreciated...

Thanks

Ulises,

It looks like python automatically casts numeric field values as strings, so you would need to change your expression to

if [CATEGORIA] == "0":

or

if int([CATEGORIA]) == 0: