Combining multiple intersect rules into one rule. I have three different point layers for our Stormwater Infrastructure. I have a single line layer that I am writing the rule in. Below is the code I wrote to try to update a field based on intersect and it does not work.
//The attribute rule is setup to pull a field value from a 'upstream' layer.
//This generates the geometry of the line layer
Var g = Geometry($feature);
//The variable generates the start point of the line
Var toPointGeom = g.paths[0][0];
//The variable calls out the point layer and a specific field with no need to return
Var fsPoint =FeatureSetByName($datastore, "GISProduction_10_7_1.SDE.D_Aprons",['FACILITYID']);
Var fsPoint2 =FeatureSetByName($datastore, "GISProduction_10_7_1.SDE.D_Manholes", ['FACILITYID']);
Var fsPoint3 =FeatureSetByName($datastore, "GISProduction_10_7_1.SDE.D_Control_Structure", ['FACILITYID'])
//Selects the first line endpoint that intersects the point
Var toPoint = (Intersects(fsPoint , toPointGeom) )
Var toPoint2 = (Intersects(fsPoint2 ,toPointGeom) )
Var toPoint3 = (Intersects(fsPoint3 ,toPointGeom) )
//The script reads if the Intersect return value is null show '-1', otherwise return the toPoint fsPoint FacilityID
If(toPoint > null){
return toPoint.FACILITYID}
else if (toPoint == null && toPoint2 > null){
return toPoint2.FACILITYID}
else if (toPoint == null && toPoint2 == null && toPoint3 > null){
return toPoint3.FACILITYID}
else{
return -1}