I am trying to create an attribute rule that would automatically update when line features are edited or created. I have gotten half of what I want the rule to accomplish, but am at a loss with the second part. I'm fairly new to Attribute Rules, so the solution may be something I've overlooked or it may not be possible, but any feedback would be greatly appreciated.
Essentially, I have line segments (e.g. Roads) that I want to intersect with a grid (e.g. Map Book Grid). I would like a comma separated list of each road (grouped by Road Name, not for each individual segment) that will update in a separate table (Master Road Names table for those familiar with Address Data Management) that could be exported or added as a Road Index as an appendix to a Map Series.
I have been able to populate a field within the roads line layer for individual segments but am struggling with how to group by road name and then write all the intersecting grid values to a single field for all of the segments.


var intersectLayer = OrderBy(Intersects(FeatureSetByName($datastore, "Grid", ["GridNum"], true), $feature), "GridNum asc")
var zones = ""
var i = 0
for (var f in intersectLayer){
i++
if (i == 1){
zones = f.GridNum
}
else {
zones += ", " + f.GridNum
}
}
return zones