HOW TO
In ArcGIS Online and Portal for ArcGIS, when working in a continuous data collection project, labels can be auto-populated by referencing field values from other layers using Arcade expressions. This article provides an example and instructions to generate a label of connected lines between two points using Arcade in ArcGIS Online and Portal for ArcGIS.
The image below shows a map in ArcGIS Online Map Viewer with labels on each point.


var pole = FeatureSetbyName($datastore, '<layerName>', ['<fieldName>'])
var line = buffer($feature, .1)
var ab = Intersects(pole, line)
var line_name = ''
for (var a in ab){
var pole_name = DomainName(a, 'Name')
line_name += pole_name + " - "}
return left(line_name, count(line_name) -2);
The code block below is an example of the full working expression.
var pole = FeatureSetbyName($datastore, 'testPoints', ['Name'])
var line = buffer($feature, .1)
var ab = Intersects(pole, line)
var line_name = ''
for (var a in ab){
var pole_name = DomainName(a, 'Name')
line_name += pole_name + " - "}
return left(line_name, count(line_name) -2);

The image below shows the newly configured values as label.

Article ID: 000030072
Get help from ArcGIS experts
Start chatting now