Hello,
I have a feature class called FC1. I also have a Table called TBL1. The feature class and table are related using a 1-M relationship.
My question is as follows. Is there any way using ArcGIS Server 10.2.2 and ESRI JS to auto label my FC1 using all the related attributes from TBL1?
Example:
Feature Class: Kennel
Table: Dog
Relationship: KennelDogs
I want to have my kennels displayed on the map and autolabel each kennel with the dog's name. So the symbol for kennel 1 would have beside it DogName1, DogName2. Kennel 2 would have DogName3, DogName4, and DogName5.
Thank you,
Alex
Hi Alex,
Try below option, this option does not use relationship class, but labels a layer based on another feature class with 1:M relation. I have not tested this with publishing the layer to ArcGIS Server. I would expect it to work with ArcGIS Server as well.
Below is the expression code used.
import arcpy
def FindLabel ( [ROUTE_LINK_NO] ):
relateTable = r"C:\tempdelete\PL_TO_LINE.gdb\PL\VERT_TO_POINIT"
returnFieldName = "POINT_M"
joinFieldName = "ROUTE_LINK_NO"
label = ""
with arcpy.da.SearchCursor(relateTable, (returnFieldName), joinFieldName + " = " + [ROUTE_LINK_NO] ) as cursor:
for row in cursor:
label = label + str(row[0]) + ","
return label