I am working on attribute rule. It is applied on two feature classes:
1. Main_FC
2. FC_Anno
The attribute rule on Main_FC is triggered on 'Update'. The rule is:
var globalId = $feature.GLOBALID;
var attach_anno = FeatureSetByName($datastore, "FC_Anno", ["FEATUREGLOBALID", "GLOBALID"], true);
var related_feature_anno = Filter(attach_anno, "FEATUREGLOBALID = @globalId");
if (related_feature_anno != null) {
var updates = [];
for (var f in related_feature_anno) {
Push(updates, {
'globalId': f.GLOBALID,
'attributes': {
'NAME': $feature.NAME
}
});
}
return {
'edit': [{
'className': 'FC_Anno',
'updates': updates
}]
};
}
The attribute rule on FC_Anno is triggered on 'Insert & Update'. The rule is:
var fglobalId = $feature.FEATUREGLOBALID;
var main_fc = FeatureSetByName($datastore, "Main_FC", ["GLOBALID"], true);
var related_main_fc = Filter(main_fc, "GLOBALID = @fglobalId");
if (related_main_fc != null) {
var updates = [];
for (var f in related_main_fc) {
Push(updates, {
'globalId': f.GLOBALID,
'attributes': {
'NAME': $feature.NAME
}
});
}
return {
'edit': [{
'className': 'Main_FC',
'updates': updates
}]
};
}
The attribute rule works fine if I disable any one of them. When both of them are enabled together, it gives an error: The evaluation of attribute rules is cyclic or exceeds maximum cascading level.
I looked into some of community discussions & solutions suggested by @HusseinNasser2 , and I understand when one feature is edited, it triggers the rule on the other class, which again edits the first class, triggering the rule again... and so on. This causes a cyclic dependency, which leads to the cascading evaluation error. However, I am still struggling to resolve this issue.
Any help on this will greatly be appreciated. Thank you.