Hey fellow-esris,
I hope all is well with you. I've been working on a project and I'm trying to set up an attribute rule (constraint) for a polygon feature class that would only allow the polygon to be moved if all intersecting features are moved with it. But I'm a bit stuck and could use some help. This is the code I got so far:
var targetAssemblyNumbers = '(2, 3, 900)'; // Assemblies which must be within stationboundaries
var targetDeviceNumbers = '(1, 2, 4, 6, 19)'; // Devices which must be within stationboundaries
var targetJunctionNumbers = '(5,50,950)'; // Junctions which must be within stationboundaries
var assemblies = FeatureSetByName($datastore, 'PipelineAssembly', ['globalid'], true)
var devices = FeatureSetByName($datastore, 'PipelineDevice', ['globalid'], true)
var junctions = FeatureSetByName($datastore, 'PipelineJunction', ['globalid'], true)
var targetAssemblies = Filter(assemblies, Concatenate(['ASSETGROUP', 'IN', targetAssemblyNumbers], ' '))
var targetDevices = Filter(devices, Concatenate(['ASSETGROUP', 'in', targetDeviceNumbers], ' '))
var targetJunctions = Filter(junctions, Concatenate(['ASSETGROUP', 'in', targetJunctionNumbers], ' '))
var preCounter = 0
preCounter += count(Intersects(targetAssemblies, Geometry($originalFeature)))
preCounter += count(Intersects(targetDevices, Geometry($originalFeature)))
preCounter += count(Intersects(targetJunctions, Geometry($originalFeature)))
var postCounter = 0
postCounter += count(Intersects(targetAssemblies, Geometry($feature)))
postCounter += count(Intersects(targetDevices, Geometry($feature)))
postCounter += count(Intersects(targetJunctions, Geometry($feature)))
if(preCounter != postCounter){
return false;
} else return true;
Any ideas or tips would be greatly appreciated.
Thanks in advance, Stefan