I am fairly new to Arcade and am trying to update the CoordinatedID field in my WaterMain layer using an attribute rule with the help of some code found here: Attribute rule script expression examples—ArcGIS Pro | Documentation
What I would like to do it grab the CoordinatedID field from my Roads (Centreline_Assets) layer and use it to populate the CoordinatedID field in my WaterMains (WaterMains_Assets) layer. They layers don't line up exactly so I am trying to buffer the road by 10m and populate the Coordinated field based on an intersection between the buffer and the WaterMains layer. Here's what I have so far:
//On Insert or Update populate Coordinate ID
var fcRoad=FeatureSetByName($datastore, "Centreline_Assets",["Coordinated_ID"])
var fcWaterMain=FeatureSetByName($datastore,"WaterMain_Assets_SplitLine",["Coordinated_ID"])
Var RoadIntersect = Intersects(Buffer(fcRoad,10,'meter'),fcWaterMain)
var AddList = []
var counter = 0
var noCID = Count(RoadIntersect)
if (noCID>0){
for (var Road in RoadIntersect){
AddList[counter]={
'Coordinated_ID':Centreline_Assets.CoordinatedID,
'attributes':{
'add_CoordinateID':$feature.Coordinated_ID
}
}
counter++
}
return {
'result': noCID + ' Coordinated ID found',
'edit': [{
'className':'Centreline_Assets',
'updates': AddList
}]
}
}else{
return 'No Coordinated ID'
}
I keep getting the following error:
Invalid expression. Error on line 4. Geometry type null expected.
Any suggestions?