<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Attribute Rule - deleting a value from an edited feature to features it intersects in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-deleting-a-value-from-an-edited/m-p/1344344#M1165</link>
    <description>&lt;P&gt;When posting code, make sure add as a code snippet.&amp;nbsp; Makes it much easier to read.&lt;/P&gt;&lt;P&gt;If you are just trying to null out the features values, it is a simple change to your code.&amp;nbsp; You will need a seperate attribute rule or you can use the edit context&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var ProjA = FeatureSetByName($datastore, "Projects_A", ["GlobalID"], true)
var IntProj = Intersects(ProjA, $feature)
var updates = []

var proj_num = iif($editcontext.editType == "DELETE",null,$feature.project_number)
for (var proj in IntProj) {
    psuh(updates, {
        'GlobalID': proj.GlobalID,
        'attributes': {'project_number':proj_num}
    })
}
return {
    'result': $feature.project_number,
    'edit': [{
        'className': 'Projects_A',
        'updates': updates
    }]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Nov 2023 12:58:37 GMT</pubDate>
    <dc:creator>MikeMillerGIS</dc:creator>
    <dc:date>2023-11-01T12:58:37Z</dc:date>
    <item>
      <title>Attribute Rule - deleting a value from an edited feature to features it intersects</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-deleting-a-value-from-an-edited/m-p/1344186#M1163</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi everyone,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I've successfully created an attribute rule on a Projects B feature class that updates a project_number field in a Projects A feature class, based on any time a new polygon is created in a Projects B feature class with the project_number from the newly created Projects B polygon (i.e. PP-2024-12345).&lt;BR /&gt;&lt;BR /&gt;This attribute rule ensures that this project_number is only inputted in the project_number field in the Projects A feature class only if the polygon from the newly created Projects B feature class intersects with one or multiple projects from Project A. I've tested this out and it currently works (albeit with some syntax issues like having a ';' inputted at the start of the result). I am wondering what it would look like to alter the script below for deleting purposes of projects from Projects B?&amp;nbsp;&lt;/P&gt;&lt;P&gt;So any time a project/polygon is deleted from the Projects B feature class, it will then delete the project_number(s) for the intersecting underlying polygons from the Projects A feature class if that makes sense. So it will know to delete the project_numbers for any previous intersecting polygons from the initial Projects A feature class anytime a separate user will delete a project/polygon from Projects B.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var ProjA = FeatureSetByName($datastore, "Projects_A", ["GlobalID"], true)&lt;BR /&gt;var IntProj = Intersects(ProjA, $feature)&lt;BR /&gt;var updates = []&lt;BR /&gt;var i = 0&lt;BR /&gt;for (var proj in IntProj){&lt;BR /&gt;updates[i++] = {'GlobalID': proj.GlobalID,&lt;BR /&gt;'attributes': {'project_number': $feature.project_number}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;return {&lt;BR /&gt;'result': $feature.project_number,&lt;BR /&gt;'edit': [{&lt;BR /&gt;'className': 'Projects_A',&lt;BR /&gt;'updates': updates&lt;BR /&gt;}]&lt;BR /&gt;}&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2023 22:16:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-deleting-a-value-from-an-edited/m-p/1344186#M1163</guid>
      <dc:creator>Boomer1187</dc:creator>
      <dc:date>2023-10-31T22:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule - deleting a value from an edited feature to features it intersects</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-deleting-a-value-from-an-edited/m-p/1344344#M1165</link>
      <description>&lt;P&gt;When posting code, make sure add as a code snippet.&amp;nbsp; Makes it much easier to read.&lt;/P&gt;&lt;P&gt;If you are just trying to null out the features values, it is a simple change to your code.&amp;nbsp; You will need a seperate attribute rule or you can use the edit context&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var ProjA = FeatureSetByName($datastore, "Projects_A", ["GlobalID"], true)
var IntProj = Intersects(ProjA, $feature)
var updates = []

var proj_num = iif($editcontext.editType == "DELETE",null,$feature.project_number)
for (var proj in IntProj) {
    psuh(updates, {
        'GlobalID': proj.GlobalID,
        'attributes': {'project_number':proj_num}
    })
}
return {
    'result': $feature.project_number,
    'edit': [{
        'className': 'Projects_A',
        'updates': updates
    }]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 12:58:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-deleting-a-value-from-an-edited/m-p/1344344#M1165</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2023-11-01T12:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule - deleting a value from an edited feature to features it intersects</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-deleting-a-value-from-an-edited/m-p/1347318#M1172</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/188597"&gt;@MikeMillerGIS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for the snippet and or your advice on using the code snippet feature. I will definitely use that in the future.&lt;/P&gt;&lt;P&gt;I had tried the above with a new separate attribute rule but when deleting a feature from Projects_B, the value is still retained in the project_number of the underlying intersecting Projects_A feature class unfortunately&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Boomer1187_0-1699467118875.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/85399i2765E6A209445C87/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Boomer1187_0-1699467118875.png" alt="Boomer1187_0-1699467118875.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you think using the replace() function would work for the underying project_number from Projects_A? Is there a function to remove a value from the string or would it be the replace() with ""?&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2023 19:06:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-deleting-a-value-from-an-edited/m-p/1347318#M1172</guid>
      <dc:creator>Boomer1187</dc:creator>
      <dc:date>2023-11-08T19:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule - deleting a value from an edited feature to features it intersects</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-deleting-a-value-from-an-edited/m-p/1347630#M1176</link>
      <description>&lt;P&gt;Without seeing the rule you used, I am not sure.&amp;nbsp; The script I posted should work.&amp;nbsp; The return edits of the delete, should update those features.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2023 11:39:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-deleting-a-value-from-an-edited/m-p/1347630#M1176</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2023-11-09T11:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule - deleting a value from an edited feature to features it intersects</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-deleting-a-value-from-an-edited/m-p/1347745#M1180</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/188597"&gt;@MikeMillerGIS&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Here are my current attribute rules for now &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;First one is an attribute rule applied on Projects_A, that updates the project_number for any intersecting polygons from Projects_B that intersect with a new or updated project from Projects_A. This is triggered on Insert and Update with the exclude from application evaluation checked on.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var projB = Intersects(FeatureSetByName($datastore, 'Projects_B', ['project_number']), $feature)

var proj_nums = []

for (var projB_row in projB) {
    Push(proj_nums, projB_row.project_number)
}
return Concatenate(proj_nums, "; ")&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;The second one is an attribute rule applied on Projects_B, that updates the project number field in the Projects_A feature class from any new polygons from Projects_B that intersects with the underlying Projects_A polygons. This is triggered on Insert and Update with the exclude from application evaluation checked on.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var ProjA = FeatureSetByName($datastore, "Projects_A", ["GlobalID"], true)
var IntProj = Intersects(ProjA, $feature)
var updates = []
var i = 0
for (var proj in IntProj){
  updates[i++] = {'GlobalID': proj.GlobalID,
                'attributes': {'project_number': $feature.project_number}
               }
}
return {
   'result': $feature.project_number, 
   'edit': [{
        'className': 'Projects_A',
        'updates': updates           
    }]
}&lt;/LI-CODE&gt;&lt;P&gt;This is the attribute rule in question applied to Projects_B, where whenever a project/polygon is deleted from Projects_B, that it triggers to delete the project_number value only, from the intersecting Projects_A polygon. The Projects_A polygon's project_number may have a single project_number or multiple separated with a ; depending on how many it intersects with. It is applied on Update and Delete with the exclude from application evaluation box checked on:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var ProjA = FeatureSetByName($datastore, "Projects_A", ["GlobalID"], true)
var IntProj = Intersects(ProjA, $feature)
var updates = []

var proj_num = iif($editcontext.editType == "DELETE",null,$feature.project_number)
for (var proj in IntProj) {
    psuh(updates, {
        'GlobalID': proj.GlobalID,
        'attributes': {'project_number':proj_num}
    })
}
return {
    'result': $feature.project_number,
    'edit': [{
        'className': 'Projects_A',
        'updates': updates
    }]
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2023 16:13:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-deleting-a-value-from-an-edited/m-p/1347745#M1180</guid>
      <dc:creator>Boomer1187</dc:creator>
      <dc:date>2023-11-09T16:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule - deleting a value from an edited feature to features it intersects</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-deleting-a-value-from-an-edited/m-p/1347750#M1181</link>
      <description>&lt;P&gt;Note, I autocorrected the psuh to 'push' as well in my code&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2023 16:16:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-deleting-a-value-from-an-edited/m-p/1347750#M1181</guid>
      <dc:creator>Boomer1187</dc:creator>
      <dc:date>2023-11-09T16:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule - deleting a value from an edited feature to features it intersects</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-deleting-a-value-from-an-edited/m-p/1347778#M1182</link>
      <description>&lt;P&gt;You will need to adjust the logic to not null out the project number and just remove it from the ; delimited list.&amp;nbsp; but I would start to ensure the logic is working.&amp;nbsp; Make a delete only rule like this and ensure it is working&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;var ProjA = FeatureSetByName($datastore, "Projects_A", ["GlobalID"], true)
var IntProj = Intersects(ProjA, $feature)
var updates = []

for (var proj in IntProj) {
    psuh(updates, {
        'GlobalID': proj.GlobalID,
        'attributes': {'project_number':null}
    })
}
return {
    'result': $feature.project_number,
    'edit': [{
        'className': 'Projects_A',
        'updates': updates
    }]
}&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 09 Nov 2023 16:43:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-deleting-a-value-from-an-edited/m-p/1347778#M1182</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2023-11-09T16:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule - deleting a value from an edited feature to features it intersects</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-deleting-a-value-from-an-edited/m-p/1347808#M1184</link>
      <description>&lt;P&gt;Sounds good, I've tested the logic to see if it works with the above and upon deletion, and panning around, I still get the same result that shows in the pop up still for Projects A with the project_number still there.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Boomer1187_0-1699549330714.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/85525i1855F44E1EC36713/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Boomer1187_0-1699549330714.png" alt="Boomer1187_0-1699549330714.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I tried deleting via deleting the row in the attribute table for Projects B as well as deleting via the edit ribbon for Projects B.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2023 17:05:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-deleting-a-value-from-an-edited/m-p/1347808#M1184</guid>
      <dc:creator>Boomer1187</dc:creator>
      <dc:date>2023-11-09T17:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule - deleting a value from an edited feature to features it intersects</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-deleting-a-value-from-an-edited/m-p/1356662#M1214</link>
      <description>&lt;P&gt;&lt;A href="https://www.esri.com/arcgis-blog/products/arcgis-pro/data-management/originalfeature-new-attribute-rules-arcade-global/" target="_blank"&gt;https://www.esri.com/arcgis-blog/products/arcgis-pro/data-management/originalfeature-new-attribute-rules-arcade-global/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/346994"&gt;@HusseinNasser2&lt;/a&gt;&amp;nbsp;I've been racking my brain and implementing so many different variations of the above to no avail. I am utilizing ArcGIS Pro 3.1 and Enterprise 10.9.1 and a FGDB to test. I noticed you wrote this useful article regarding original feature globals. Do you think this would serve my purpose in nulling or removing the project_number value in Projects_A anytime an intersecting record n Projects_B is deleted/removed? Perhaps if it is used for the global id value or any other value that would essentially 'change' if a polygon from Projects_B is deleted? Any advice would be helpful - thanks so much.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 00:42:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-deleting-a-value-from-an-edited/m-p/1356662#M1214</guid>
      <dc:creator>Boomer1187</dc:creator>
      <dc:date>2023-12-05T00:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule - deleting a value from an edited feature to features it intersects</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-deleting-a-value-from-an-edited/m-p/1584026#M1679</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/691819"&gt;@Boomer1187&lt;/a&gt;&amp;nbsp;, do you have any news or a functioning workaround for this issue yet?&lt;BR /&gt;&lt;BR /&gt;I've been trying to do something similar, i.e. to force update on the feature in layer B which intersects or has a common attribute value with the feature in layer A that is being deleted. This update in layer B would then trigger another attribute rule set on that layer.&amp;nbsp; As far as I get it, references to either $feature or $originalfeature global variables don't work for the delete context as the feature no longer exists when the rule is evaluated.&lt;BR /&gt;&lt;BR /&gt;My only idea is to force update on all features in the target layer, but well... that's obviously not effective.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2025 15:06:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-deleting-a-value-from-an-edited/m-p/1584026#M1679</guid>
      <dc:creator>SydorukMariya</dc:creator>
      <dc:date>2025-02-11T15:06:07Z</dc:date>
    </item>
  </channel>
</rss>

