AnsweredAssumed Answered

Advanced Python Labels are not appearing in Map Service.

Question asked by dineshpatil on Sep 15, 2017
Latest reply on Sep 27, 2018 by INVOLVER87



I am trying to assign labels to feature layer using advance python labelling.


The label are fetching from feature layer related table using following python script logic, which is given at ESRI Tech Support How To: Label a related table 

def FindLabel ([keyField], [FirstLabel]):
    import arcpy

    key1 = [keyField] # Key field in feature class
    key2 = "ID"   # Key field in related table
    L = [FirstLabel] # Label field in feature class
    L2 = "Label2"   # Label field in related table
    myDataTable = r"<path-to-related-table>"   # Path to related table
    cur = arcpy.da.SearchCursor(myDataTable, [key2, L2])
    for row in cur:
        if str(key1) == str(row[0]):
            L = L + " " + str(row[1])
    return L


The label are appearing in 'ArcMap'  window.  While publishing the feature layer as a Map Service; In the publishing preview window the labels do appear, but not in the finished service.