AnsweredAssumed Answered

Labeling Related Table - Python

Question asked by empeypp on Aug 24, 2015
Latest reply on Aug 24, 2015 by wwmiller68

Hello,

 

I'm working on a small project to label points based on a related table. I was able to get the labeling to work using this script:

 

def FindLabel([SIGN_ID]):
    strWhereClause = '"sign_ID" = \'{0}\''.format([SIGN_ID])
    strpTable = "agencies.DATA_ADMIN7.signs"
    cursor = arcpy.da.SearchCursor(strpTable,"sign_order", strWhereClause)
    result = ""
    for row in cursor:
        strLabel = str(row[0])
        result += strLabel + "\n"
        sort_fields = [["sign_order", "ASCENDING"]]
    return result.rstrip()

 

What I need to do now is sort the results of the labeling by a certain field (in ascending order). Currently, the labels are showing up based on objectID and display as 1,3,2, I need to have them show up based on a "sign_Order" field - 1,2,3.

 

Does anyone know how to sort the labels in this way?

 

Any help is greatly appreciated!!

 

Thanks,
Pat

Outcomes