Hi everyone,
I've successfully created an attribute rule on a Projects B feature class that updates a project_number field in a Projects A feature class, based on any time a new polygon is created in a Projects B feature class with the project_number from the newly created Projects B polygon (i.e. PP-2024-12345).
This attribute rule ensures that this project_number is only inputted in the project_number field in the Projects A feature class only if the polygon from the newly created Projects B feature class intersects with one or multiple projects from Project A. I've tested this out and it currently works (albeit with some syntax issues like having a ';' inputted at the start of the result). I am wondering what it would look like to alter the script below for deleting purposes of projects from Projects B?
So any time a project/polygon is deleted from the Projects B feature class, it will then delete the project_number(s) for the intersecting underlying polygons from the Projects A feature class if that makes sense. So it will know to delete the project_numbers for any previous intersecting polygons from the initial Projects A feature class anytime a separate user will delete a project/polygon from Projects B.
--
var ProjA = FeatureSetByName($datastore, "Projects_A", ["GlobalID"], true)
var IntProj = Intersects(ProjA, $feature)
var updates = []
var i = 0
for (var proj in IntProj){
updates[i++] = {'GlobalID': proj.GlobalID,
'attributes': {'project_number': $feature.project_number}
}
}
return {
'result': $feature.project_number,
'edit': [{
'className': 'Projects_A',
'updates': updates
}]
}