Hello @XanderBakker ,
Can I use the attribute rules to intersect two features to update an attribute. If the tracks fc intersect with the line buffer I created I want to update the field in the line buffer to Yes or No to determine if the tracks intersect.
I can get the code to execute in the Calculate Field Tool but cannot get it to work as an attribute rule.
Solved! Go to Solution.
Hi @DonovanC ,
Not sure what is going wrong. I just did a test changing the attribute of the polygons depending if there are points inside the polygon and it all works as expected.
Arcade expression:
Capturing a new polygon with a point inside:
... automatically gets codes with "Yes" (green):
and when creating a polygon that has no point inside:
will automatically get the code "No" (red):
Maybe it is data related. Would it be possible te receive a small sample of the data?
Hey @XanderBakker
This is a screen shot of the tracks that intersect the buffer.
Here is the code, I used the same script from the field calculator and I thought that it would apply the same as an attribute rule.
Thanks Donovan
Hi @DonovanC ,
The first thing to look at would be making sure that your layer has GlobalID's. This is required for an attribute rule to work.
I did a test with some slightly different code and it seems to work:
var fs = FeatureSetByName($datastore, "buffers");
var LeakSurveys = Intersects(fs, $feature);
if (Count(LeakSurveys) > 0) {
return "Yes";
} else {
return "No";
}
The expression:
Attribute rule configuration:
The result symbolized by LeakSurvey (Yes/No):
Remember to check your GlobalID's:
That's exactly what I want but in my case I want my buffer line to indicate Yes/No if the point falls within the buffer and not the points showing the indication. The naming convention I created might seem a bit confusing, sorry about that. My fs "Tracks_Buffers" are the points.
The Polygon with the buffer has Global ID's already.
Hi @DonovanC ,
Not sure what is going wrong. I just did a test changing the attribute of the polygons depending if there are points inside the polygon and it all works as expected.
Arcade expression:
Capturing a new polygon with a point inside:
... automatically gets codes with "Yes" (green):
and when creating a polygon that has no point inside:
will automatically get the code "No" (red):
Maybe it is data related. Would it be possible te receive a small sample of the data?
Hi @DonovanC ,
I tried to reply you private message, but I think there is something not working correctly at this moment. I was not able to download the ZIP you shared, since for some reason it end up downloading a download.html page and not the ZIP (weird). Also when I tried to answer with a private message an error occurred.
If possible please send the ZIP to "xbakker[at]esri.co" (and yes ".co" stands for Colombia).
Hi,
I am interested in this particular behavior for Attribute Rules and I do have another question: in your example, if the point in the first green polygon is deleted, would the polygons automatically gets codes with "No"? I believe not.
Behavior on attribute rules applies on Insert, Update and Delete, for the polygons... But if an Insert, Update and Delete happens on the points, it is not reflected in the polygon attribute rule. Does this make sense?
For example, the squared polygons below use an attribute rule to sum the employees of intersecting points. When the rule runs on polygons, it calculates 1,557. However, if a point if updated with +100 employees, the rule on polygons is not runned (not triggered)! The attribute stays 1,557 but it should now shows 1,657.
I have exactly the same Arcade script in use for PopUps and it does updates to 1,657 because the Arcade code is executed each time you open the PopUps.
Is there any code in Arcade to introduce some 'events'? I mean to run the Arcade attribute rule in polygons if any updates are performed in the underlying layers used in the Arcade code...