AnsweredAssumed Answered

Labels do not appear in ArcGIS Online

Question asked by INVOLVER87 on Oct 2, 2018
Latest reply on Oct 2, 2018 by MidnightYell2003

Hello, 

 

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

 

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

 

I can see the labels in ArcMap or in the preview before I publish it as a web service, but cannot see them in ArcGIS Online. I suspect there might be a problem with the path I use in the label expression.

It looks something like this: r"Database Connections\TEST.sde\Related_Table". Am I missing something?

 

Also, I have created a brand new geodatabe, where I put a feature class and a related table I want to get the labels from. In this case my paths looks like that - r"C:\Test.gdb\Related_Table". Again, it works fine in ArcMap, but there are no labels after I have published it as a web service?

 

Please, help!

 

Thanks heaps in advance!

Outcomes