Attribute Rules Intersect

4193
7
Jump to solution
11-17-2020 08:24 AM
DonovanC
New Contributor III

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.

DonovanC_0-1605629591040.png

 

0 Kudos
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

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:

XanderBakker_0-1605724691488.png

 

Capturing a new polygon with a point inside:

XanderBakker_1-1605724840182.png

... automatically gets codes with "Yes" (green):

XanderBakker_2-1605724881447.png

and when creating a polygon that has no point inside:

XanderBakker_3-1605724919852.png

will automatically get the code "No" (red):

XanderBakker_4-1605724955224.png

 

Maybe it is data related. Would it be possible te receive a small sample of the data?

 

View solution in original post

7 Replies
XanderBakker
Esri Esteemed Contributor

Hi @DonovanC ,

 

Can you share a screenshot of how you configured the calculation attribute rule?

0 Kudos
DonovanC
New Contributor III

Hey @XanderBakker 

DonovanC_0-1605709650813.png

This is a screen shot of the tracks that intersect the buffer.

DonovanC_1-1605709779532.png

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

 

Tags (2)
XanderBakker
Esri Esteemed Contributor

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:

XanderBakker_0-1605718401214.png

 

Attribute rule configuration:

XanderBakker_1-1605718423194.png

 

The result symbolized by LeakSurvey (Yes/No):

XanderBakker_2-1605718455995.png

 

Remember to check your GlobalID's:

XanderBakker_3-1605718546032.png

 

 

0 Kudos
DonovanC
New Contributor III

Hi @XanderBakker 

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. 

DonovanC_0-1605720450786.png

 

The Polygon with the buffer has Global ID's already.

Tags (2)
0 Kudos
XanderBakker
Esri Esteemed Contributor

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:

XanderBakker_0-1605724691488.png

 

Capturing a new polygon with a point inside:

XanderBakker_1-1605724840182.png

... automatically gets codes with "Yes" (green):

XanderBakker_2-1605724881447.png

and when creating a polygon that has no point inside:

XanderBakker_3-1605724919852.png

will automatically get the code "No" (red):

XanderBakker_4-1605724955224.png

 

Maybe it is data related. Would it be possible te receive a small sample of the data?

 

XanderBakker
Esri Esteemed Contributor

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).

0 Kudos
VincentLaunstorfer
Occasional Contributor III

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...

VincentLaunstorfer_0-1673002963377.png

 

0 Kudos