Select to view content in your preferred language

Calculation works and does not work depending on number of features.

574
2
10-09-2023 12:32 AM
Aнастасия88
Occasional Contributor

Hello community,

Following the immediate calculation rule example for updating features in the same feature class (calculation rule update a record in the same feature class), I have come across a mysterious problem that results in two different scenarios, seems to be caused by the difference in the number of features that share the same attribute as the one being edited.

The rule will trigger an error if the number of records sharing the same attribute is greater than five. However, if the number of records sharing the same attribute is less than six, it works as configured.

For example, there are six records that have 'AAA' in the 'NAME' field in the table below. In this case, the calculation ends up with an error, displaying the message "evaluation of attribute rules is cyclic or exceeds the maximum cascading level." However, the calculation works as configured if the records with 'AAA' are less than six – please see the pictures below.

I have used the code from the thread and only altered the feature class name and field name. Any clue would be appreciated.

Gets error if features are more than five. Tried to edit AAA to DDDD.

Error - if other features more than fiveError - if other features more than five

Works if features are less than six. Edited AAA to DDDD

Works - if other feature less than sixWorks - if other feature less than six

Tags (2)
0 Kudos
2 Replies
MikeMillerGIS
Esri Frequent Contributor
Can you post your code so we can see what is going on.
0 Kudos
Aнастасия88
Occasional Contributor

I have prepared the code as per below below based on the example in another question, but this code did not work as mentioned.

 

var old_value = $originalfeature.NAME;
var new_value = $feature.NAME;

if (new_value == old_value) {return}

var gid = $feature.GlobalID;
var other_features = Filter(FeaturesetByName($datastore, "TableA", ["*"]), "NAME = @old_value AND GlobalID <> @gid");

var updates = [];
for (var f in other_features) {
    Push(updates, { globalID: f.GlobalID, attributes: { NAME: new_value } });
}

return {
    edit: [
        {
            className: "TableA",
            updates: updates,
        },
    ],
};

 

0 Kudos