Arcade expression question

873
3
11-07-2021 08:57 PM
Aнастасия88
Regular Contributor

Hello people, I came across an error, "The evaluation of attribute rules is cyclic or exceeds maximum cascading level." during editing a feature with an attribute rule made by arcade expression.

A0328_0-1636345834667.png

As I am new to Arcade, I referenced a sample expression from github to set up the rules that divides a line into two features. The original code works fine that uses a point feature to divide a line at the intersection with the line feature. But I used a start point of a line feature instead of a point feature for my purpose. After I made the simple change in the code, edit works sometimes but get above error sometime randomly. For example, even if I get the error, if I change a place to draw a line feature, then it works without the error.

I have been searching any clue regarding this error but have not had any luck yet. Any help would be much appreciated. Thanks in advance!

 

Tags (1)
0 Kudos
3 Replies
JohannesLindner
MVP Frequent Contributor

We'd gladly help you, but we need to see the actual code you used for that. Please post that:

JohannesLindner_0-1636351795217.png

JohannesLindner_1-1636351826529.png

 


Have a great day!
Johannes
JohannesLindner
MVP Frequent Contributor

Problem is probably in line 43:

var intersecting_lines = Intersects(line_fs, start_point);

What this code does (in a very general way) is this:

  1. get the lines that intersect the start point of $feature
  2. request edits to be made on those lines
    1. for each of those lines, goto 1

But intersecting the start point of $feature with the lines also finds $feature, so you're editing $feature and request edits to be made to $feature and it just cycles endlessly (or it would, but ArcGIS stops it).

 

Try adding this after line 43:

var gid = $feature.GlobalID
intersecting_lines = Filter(intersecting_lines, "GlobalID <> @gid"))

This will remove $feature from the edited lines.


Have a great day!
Johannes
0 Kudos
Aнастасия88
Regular Contributor

Thanks a lot for your help!

But unfortunately, I still got a same error after I added the given code like below.

var start_point = Geometry($feature).paths[0][0]
var intersecting_lines = Intersects(line_fs, start_point);
var gid = $feature.GlobalID
intersecting_lines = Filter(intersecting_lines, "GlobalID <> @gid")

0 Kudos