Summary
A feature labelled with descriptive text is helpful when there are multiple features available in a close distance. The label displays the values of certain fields from the attribute table. Sometimes, features of one table are associated with features of another table through joins or relates.
Procedure
To label a feature with multiple records, the feature must be in a permanent one-to-many join. The following steps describe how to do so:
- Use the Make Query Table tool to make a permanent join between the selected records. Refer to ArcGIS Pro: Make Query Table for more information on the tool. This tool creates a new feature layer.
- Open the newly created feature attribute table, and add a new Text type field. Refer to ArcGIS Pro: Add data to an existing table for more information.
- Click Calculate
in the attribute table to open the Calculate Field console. Select the newly created field from the Field Name drop-down list, and select Python 3 in the Expression Type drop-down list. - Type the following script in the expression text box:
isDuplicate(!<Selected_Field_ To_Label>!)
- Insert the following script in the Code Block text box to identify repeating values, and replace them with Null and 0.
uniqueList=[]
def isDuplicate(inValue):
if inValue in uniqueList:
return 0
else:
uniqueList.append(inValue)
Click the
Verify 
button to ensure the expression is valid, and click
Run.
- Clear the script in the Code Block text box, and insert the following script in the expression text box to replace all Null and O values with a blank value.
'Name:!<Selected_Field_ To_Label>!' if !<New_Field_Name>! is None else " "
Click Run.
- Right-click the feature layer and select Labelling Properties to open the Label Class console. Select the Python parser from the Language drop-down selection, and check the Advanced check box.
- Type the following script in the Expression text box:
def FindLabel ([New_Field_Name],[Field_Name2],[Field_Name3]):
myText = [New_Field_Name]
if [Field_Name3] == "<Desired_Text>":
myText = myText + "<CLR blue = '255'>"+[Field_Name2]+"</CLR>"+ "\n"
else:
myText = myText + "<CLR red = '255'>"+[Field_Name2]+"</CLR>"+ "\n"
return myText
Click Apply.