Hello,
I am trying to make an Attribute Rule in ArcGIS Pro to auto populate a Rotation field for a sanitary flow direction point intersecting with a sanitary main feature class. This way with using the rotation field I can set the symbology rotation to reflect which was the sanitary main is flowing. With the arcade expression below, I keep coming up with the error Arcade Error: Unexpected Null. Any idea on what I am doing wrong? The error is attached and the code is below.
// Find the first intersecting line from the intersecting class
var lineClass = FeatureSetByName($datastore, "ssGravityMain", ["objectid"], true)
var line = First(Intersects(lineClass, $feature))
// If no feature was found, return the original value
if (line == null)
{
return $feature.ROTATION
}
// Buffer the point by a small amount to extract the segment
var search = Extent(Buffer($feature, .01, "feet"))
var segment = Clip(line, search)["paths"][0]
// Get angle of line using the start and end vertex
if(isempty($feature.ROTATION)) return Angle(segment[0], segment[-1])