I have been working with the Data reviewer in ArcMap and am now exploring the Data reviewer and Attribute rules in Pro. Currently, I am trying to create a few constraint type attribute rules with Arcade, but for some rules I have not been able to get the right result. I don't have any scripting experience, so working with the Arcade expressions is still a bit of a challenge for me.
I would like to create a rule for a line feature class (FC1) stating that this line (except for lines of type 1) should always be on top of a line from another feature class (FC2). I have been able to create a rule with the Intersects function, but of course this rule still approves lines from FC1 that only cross or partly intersect lines from FC2. This is the rule I created:
var FC2 = FeatureSetByName($datastore, "FC2",["objectid"], true);
var int = Intersects(FC2, Geometry($feature));
if (First(int) == null && $feature.FC1TYPE != 1)
return false;
else
return true;
Now I would like to replace the Intersects function with a Within function, but I don't know how to do this. I have tried several options, but none of them seem to work properly. In most cases all edits/inserts are seen as actions that are violating the rule. It probably has something to do with the output of the function, either being featureset or a boolean. It's not yet clear to me when the geometry functions return a boolean or a featureset.
I know there are also a few ready-to-use rules which don't require custom Arcade expressions, but I would like to learn how to create these expressions. I have also looked at several examples of Attribute rules, but I find it difficult to translate these to my situation. Most of the examples are still a bit too complicated for me.
Can someone show me how I can recreate this rule with a Within function?
Thank you very much!