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): L = L + " " + str(row) return L
I think you may be right on the data path. From what I recall, "\t" in python acts as a tab (not sure of "\T" would though, like you have in your path). Maybe you could try forward slashes instead of backslashes.
Ok, I think the issue is AGOL. Labeling is quite limited in AGOL and when just publishing a feature class, you can only see so many labels. Publishing a map service (through ArcGIS Enterprise) will allow more advanced label functionality.
Maplex Label engine is support in map services:
For Feature Service, first be sure you have labels turned on and take a look at this article on labeling:
But, likely you will have to explore custom labels with ArcGIS Arcade:
There is an old blog post that mentions another approach at custom labels but not sure this is still applicable.: