Hello, I'm trying to extract data from a layer's field and insert into another layer's field based on attributes matching each other from both features, but I'm struggling to create the correct script.
My scenario is I have a Utility Pole layer and Cable layer, wherein I have a field in both layers for the combined lat/long coordinates, and as I create new features in the Cable Layer I need to provide both the Start Pole ID and End Pole ID on which the cable is attached (Start ID and End ID are fields in Cable Layer, and Pole Layer has an ID field). So my thought, if possible, is to create an Arcade script in the Cable Start/End ID fields that will look at the Pole layer's Lat/Long coordinate field for a feature with the matching coordinates to the Cable's feature, and if there is a match then extract that Pole Feature's ID and insert in either the corresponding Start or End ID field of the Cable feature. Below is what I have, code is being written within the Start ID and/or End ID fields of the Cable layer feature, however it does not work:
var Pole = FeatureSetByName($map, "Pole", ['LatLong'])
var PoleID = FeatureSetByName($map, "Pole", ['ID'])
if($feature.LatLong == Pole) {return PoleID}
Appreciate any help and insight anyone could offer! Thank you!