For a PipelineLeaks feature, I tried to summarize the length field from Intersected pipeline.
A pipeline can have many segments, but all have the same GIS_PIPE_ID. I tried to: intersect and find the GIS_PIPE_ID from intersected segment, then filter the pipeline feature by this ID and summarize the PIPE_LENGTH field
This expression have an error:

// This rule will populate the edited features field LENGTH with a sum of PIPE_LENGTH from selected pipelines with same GIS_PIPE_ID
// Value to copy from the intersected feature
var intersecting_field = "GIS_PIPE_ID"
//Field rule is assigned to in the Attribute Rule
var feature_field = "LENGTH"
// Create feature set to the intersecting class
var PipeToIntersect = FeatureSetByName($datastore, "Pipelines")
// Intersect the edited feature with the feature set and retrieve the first feature
var search_feature = buffer($feature,0.5,"meter")
var IntersectedPipe = First(Intersects(PipeToIntersect, search_feature))
//select pipelines by GIS_PIPE_ID
var ID = IntersectedPipe[intersecting_field]
var PipelinesFilteredByID = FeatureSetByName($datastore, "Pipelines",["GIS_PIPE_ID","LENGTH"],true)
var SelectAllSegmentsSameID = filter(PipelinesFilteredByID,ID)
// If this pipeline have many segments, return a sum of PIPE_LENGTH
var PipelineSegmentsNumber = Count(SelectAllSegmentsSameID)
if (PipelineSegmentsNumber > 1)
{
feature_field = Sum(SelectAllSegmentsSameID, "PIPE_LENGTH");
}
feature_field = round(IntersectedPipe["PIPE_LENGTH"],2)
return feature_field