AnsweredAssumed Answered

Python Label Expression; Using multiple if's to label fields > 0

Question asked by MCAGIS on Mar 2, 2015
Latest reply on Nov 16, 2015 by bixb0012

I've written this code, and the expression checks out, but it only labels the first field. Can someone tell me why it doesn't run through the rest of the if's to create a stacked label with field >0?

 

def FindLabel ( [Light_Numb], [IN_FDN] , [IN_35_FT_METAL_POST] , [IN_35_5] , [IN_40_5] , [IN_6_FT_ARM] , [IN_12_FT_ARM] , [IN_18_FT_ARM] , [IN_X_ARM] , [IN_LED_87W_OH] , [IN_LED_101W_OH] , [IN_LED_110W_OH] , [IN_LED_260W_OH] , [IN_LED_87W_UG] , [IN_LED_101W_UG] , [IN_LED_110W_UG] , [IN_LED_260W_UG] , [IN_PC] , [IN_SC] , [CONC_WORK_REQ_SQ_FT]  ):

 

 

try:

    if [Light_Numb] > 0:

        return [Light_Numb]

    '\n'

    if [In_FDN] > 0:

        return 'In FDN', [IN_FDN]

    '\n'

    if [IN_35_FT_METAL_POST] > 0:

        return 'IN 35 FT METAL POST', [IN_35_FT_METAL_POST]

    '\n'

    if [IN_35_5] > 0:

        return 'IN 35-5', [IN_35_5]

    '\n'

    if [IN_40_5] > 0:

        return 'IN 40-5', [IN_40_5]

    '\n'

    if [IN_6_FT_ARM] > 0:

        return 'IN 6 FT ARM', [IN_6_FT_ARM]

    '\n'

    if [IN_12_FT_ARM] > 0:

        return 'IN 12 FT ARM', [IN_12_FT_ARM]

    '\n'

    if [IN_18_FT_ARM] > 0:

        return 'IN_18 FT ARM', [IN_18_FT_ARM]

    '\n'

    if [IN_X_ARM] > 0:

        return 'IN X ARM', [IN_X_ARM]

    '\n'

    if [IN_LED_87W_OH] > 0:

        return 'IN LED 87W', [IN_LED_87W_OH]

    '\n'

    if [IN_LED_87W_UG] > 0:

        return 'IN LED 87W', [IN_LED_87W_UG]

    '\n'

    if [IN_LED_101W_OH] > 0:

        return 'IN LED 101W', [IN_LED_101W_OH]

    '\n'

    if [IN_LED_101W_UG] > 0:

        return 'IN LED 101W', [IN_LED_101W_UG]

    '\n'

    if [IN_LED_110W_OH] > 0:

        return 'IN LED 110W', [IN_LED_110W_OH]

    '\n'

    if [IN_LED_110W_UG] > 0:

        return 'IN LED 110W', [IN_LED_110W_UG]

    '\n'

    if [IN_LED_260W_OH] > 0:

        return 'IN LED 260W', [IN_LED_260W_OH]

    '\n'

    if [IN_LED_260W_UG] > 0:

        return 'IN LED 260W', [IN_LED_260W_UG]

    '\n'

    if [IN_PC] > 0:

        return 'IN PC', [IN_PC]

    '\n'

    if [IN_SC] > 0:

        return 'IN SC', [IN_SC]

    '\n'

    if [CONC_WORK_REQ_SQ_FT] > 0:

        return 'CONC WORK REQ SQFT', [CONC_WORK_REQ_SQ_FT]

except:

return 'None'

Outcomes