<?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: Delete in a table1 does not set the value as null in featureclass1, due to another conflicting update rule in featureclass. in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/delete-in-a-table1-does-not-set-the-value-as-null/m-p/1637488#M1840</link>
    <description>&lt;P&gt;Not sure what is going on, but calling Count and then First is bad for performance.&amp;nbsp; Just call First and if there is a result, do something, if not, exit/continue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any chance you could share a repo GDB, it is hard to trouble shoot what is going on.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Jul 2025 23:08:11 GMT</pubDate>
    <dc:creator>MikeMillerGIS</dc:creator>
    <dc:date>2025-07-29T23:08:11Z</dc:date>
    <item>
      <title>Delete in a table1 does not set the value as null in featureclass1, due to another conflicting update rule in featureclass.</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/delete-in-a-table1-does-not-set-the-value-as-null/m-p/1636975#M1835</link>
      <description>&lt;DIV class=""&gt;&lt;P&gt;The issue is a conflict between two ArcGIS Pro attribute rules.&lt;/P&gt;&lt;P&gt;One rule, triggered by deleting a record in Maximo_location&amp;nbsp;table, aims to set the maximolocationId field in ElectricDevice&amp;nbsp; feature class to null. However, a separate calculation rule in ElectricDevice&amp;nbsp;feature class, which triggers on any insert or update, immediately overwrites (&lt;EM&gt;this is what I think so, my this assumption might be wrong.&lt;/EM&gt;) this null value, attempting to re-populate it from Maximo_location (which no longer exists for the just now deleted record).&lt;/P&gt;&lt;P&gt;But by disabling the ElectricDevice update rule confirmed it was the cause, allowing the Maximo_location delete rule to successfully nullify the field.&lt;/P&gt;&lt;P&gt;ArcGIS Pro version: 3.3.1&lt;/P&gt;&lt;P&gt;any inputs ?&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/346994"&gt;@HusseinNasser2&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 29 Jul 2025 09:57:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/delete-in-a-table1-does-not-set-the-value-as-null/m-p/1636975#M1835</guid>
      <dc:creator>RavindraSingh</dc:creator>
      <dc:date>2025-07-29T09:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: Delete in a table1 does not set the value as null in featureclass1, due to another conflicting update rule in featureclass.</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/delete-in-a-table1-does-not-set-the-value-as-null/m-p/1636987#M1836</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/6481"&gt;@RavindraSingh&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Could you please post a snippet of the code that you are using if it does not contain sensitive information? It sounds like you are trying to accomplish something that similar to what we have since we also use Maximo as well. Well not us but another department that we work with.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jul 2025 16:54:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/delete-in-a-table1-does-not-set-the-value-as-null/m-p/1636987#M1836</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2025-07-28T16:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: Delete in a table1 does not set the value as null in featureclass1, due to another conflicting update rule in featureclass.</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/delete-in-a-table1-does-not-set-the-value-as-null/m-p/1637013#M1837</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/22623"&gt;@RPGIS&lt;/a&gt;&amp;nbsp;here is the code snippet.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;FYI:&lt;/STRONG&gt; There are no relationship classes between these two objects.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Rule1-ToUpdate value in ElectricDevice, whenever any Inser/Update/Delete happens in MaximoLocation table.&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;/*Rule1-ToUpdate value in ElectricDevice, whenever any Inser/Update/Delete happens in MaximoLocation table. */

var l_tablename = $feature.tablename
var l_obje_ref_id = $feature.objectrefid
var l_id = $feature.id
var l_edits = []

if ($editcontext.edittype == "DELETE") {
    l_id = null
}

if (l_tablename == "ElectricDevice") {
    var l_features = Filter(FeatureSetByName($datastore, "ElectricDevice"), "id = @l_obje_ref_id AND assetGroup == 16")
    if (Count(l_features) != 0) {
        var l_record = First(l_features)
        var l_update_edit = {
            "className": "ElectricDevice",
            "updates": [{
                "objectid": l_record.objectid,
                "attributes": {
                    "maximolocationid": l_id
                }
            }]
        }
        Push(l_edits, l_update_edit)
    }
}

// Return edits to apply in ElectricDevice feature class
return {
    "edit": l_edits
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Rule-2 on ElectricDevice feauture class, this executes whenever any Inser/Update happends in&amp;nbsp;ElectricDevice&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;/* Rule-2 Applied on ElectricDevice feature claass, it executes when any Inser/Update happens in this feature class. It's only updates 'maximolocationid' field.*/

var l_asset_grp = $feature.assetgroup
var l_asset_type = $feature.assettype
var l_id = $feature.id

// Check 'ASSETGROUP = 16 AND ASSETTYPE = 0'
if (l_asset_grp == 16 ) {
    var l_features = Filter(FeatureSetByName($datastore, "Maximo_location"), "objectrefid = @l_id AND tablename = 'ElectricDevice'")
    if (Count(l_features) != 0) {
        return first(l_features).id
    }
}

// Deafult return
return $feature.maximolocationid&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 28 Jul 2025 17:36:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/delete-in-a-table1-does-not-set-the-value-as-null/m-p/1637013#M1837</guid>
      <dc:creator>RavindraSingh</dc:creator>
      <dc:date>2025-07-28T17:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: Delete in a table1 does not set the value as null in featureclass1, due to another conflicting update rule in featureclass.</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/delete-in-a-table1-does-not-set-the-value-as-null/m-p/1637120#M1838</link>
      <description>&lt;P&gt;I am confused by the line below. Is there a field called table name.&lt;/P&gt;&lt;PRE&gt;var l_features = Filter(FeatureSetByName($datastore, "Maximo_location"), "objectrefid = @l_id AND tablename = 'ElectricDevice'")&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Jul 2025 20:57:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/delete-in-a-table1-does-not-set-the-value-as-null/m-p/1637120#M1838</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2025-07-28T20:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: Delete in a table1 does not set the value as null in featureclass1, due to another conflicting update rule in featureclass.</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/delete-in-a-table1-does-not-set-the-value-as-null/m-p/1637197#M1839</link>
      <description>&lt;P&gt;Yes, there is a field with name as 'tablename' in 'maximo_location' table.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2025 05:40:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/delete-in-a-table1-does-not-set-the-value-as-null/m-p/1637197#M1839</guid>
      <dc:creator>RavindraSingh</dc:creator>
      <dc:date>2025-07-29T05:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: Delete in a table1 does not set the value as null in featureclass1, due to another conflicting update rule in featureclass.</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/delete-in-a-table1-does-not-set-the-value-as-null/m-p/1637488#M1840</link>
      <description>&lt;P&gt;Not sure what is going on, but calling Count and then First is bad for performance.&amp;nbsp; Just call First and if there is a result, do something, if not, exit/continue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any chance you could share a repo GDB, it is hard to trouble shoot what is going on.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2025 23:08:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/delete-in-a-table1-does-not-set-the-value-as-null/m-p/1637488#M1840</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2025-07-29T23:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: Delete in a table1 does not set the value as null in featureclass1, due to another conflicting update rule in featureclass.</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/delete-in-a-table1-does-not-set-the-value-as-null/m-p/1637581#M1842</link>
      <description>&lt;P&gt;It seems like, correct me if I am wrong, that you are trying to filter object ids. This isn't recommended at all, specifically since object ids are unique to each record and can be hard to filter by. This could be causing your issue.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 12:21:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/delete-in-a-table1-does-not-set-the-value-as-null/m-p/1637581#M1842</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2025-07-30T12:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: Delete in a table1 does not set the value as null in featureclass1, due to another conflicting update rule in featureclass.</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/delete-in-a-table1-does-not-set-the-value-as-null/m-p/1637588#M1843</link>
      <description>&lt;P&gt;This may resolve your issue but it is hard to say without knowing what common attributes exist between the two datasets.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var lag = $feature.assetgroup
var lat = $feature.assettype
var lid = $feature.id
var ML = FeatureSetByName($datastore, "Maximo_location")
	
// Check 'ASSETGROUP = 16 AND ASSETTYPE = 0'
if (lag == 16 ){
    var F = First(Filter(ML, "maximolocationid =  AND assetGroup == @lag"))
    if(TypeOf(l_features) == 'Feature'){ lid = First( l_features ).maximolocationid }
    }
return lid&lt;/LI-CODE&gt;&lt;LI-CODE lang="javascript"&gt;var TblName = $feature.tablename
var MaxLocID = $feature.id
var ET = $editcontext.edittype
var RelTbl = FeatureSetByName($datastore, "ElectricDevice")

var l_edits = Null
if (TblName == "ElectricDevice") {
    var T = First(Filter(RelTbl, "maximolocationid = @MaxLocID AND assetGroup = 16"))
	if( TypeOf(T) == 'Feature' ){
		l_edits = [{ "className": l_tablename, "updates": [{ "objectid": T.objectid, "attributes": { "maximolocationid": MaxLocID } }] }]
		}
	}

// Return edits to apply in ElectricDevice feature class
if( ET == 'DELETE' ){ MaxLocID = Null }

var V = { 'result' : {'attributes':{ id: MaxLocID } } }
if( Count( l_edits ) &amp;gt; 0 ){ V['edit'] = l_edits }
return V&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 16:13:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/delete-in-a-table1-does-not-set-the-value-as-null/m-p/1637588#M1843</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2025-07-30T16:13:45Z</dc:date>
    </item>
    <item>
      <title>Re: Delete in a table1 does not set the value as null in featureclass1, due to another conflicting update rule in featureclass.</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/delete-in-a-table1-does-not-set-the-value-as-null/m-p/1637633#M1845</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/22623"&gt;@RPGIS&lt;/a&gt;&amp;nbsp;&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;&lt;!--   StartFragment    --&gt;&lt;/P&gt;&lt;P&gt;Based on my limited understanding, the issue appears to originate from Calculation &lt;STRONG&gt;Rule-2&lt;/STRONG&gt; applied to the &lt;STRONG&gt;maximolocationId&lt;/STRONG&gt; field in the &lt;STRONG&gt;ElectricDevice&lt;/STRONG&gt; feature class. &lt;STRONG&gt;Rule-2&lt;/STRONG&gt; is triggered on insert/update events for &lt;STRONG&gt;ElectricDevice&lt;/STRONG&gt;, and may inadvertently overwrite the null value previously set by &lt;STRONG&gt;Rule-1&lt;/STRONG&gt;. This occurs because edits pushed to &lt;STRONG&gt;ElectricDevice&lt;/STRONG&gt; during a deletion from the &lt;STRONG&gt;Maximo_location&lt;/STRONG&gt; table trigger &lt;STRONG&gt;Rule-2&lt;/STRONG&gt; again, causing a conflict.&lt;/P&gt;&lt;P&gt;It seems this behavior might stem from a design-level concern, where the two rules are not harmonized and end up conflicting. I’d really appreciate your insights on whether this approach needs reevaluation.&lt;/P&gt;&lt;P&gt;&lt;!--   EndFragment    --&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 14:59:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/delete-in-a-table1-does-not-set-the-value-as-null/m-p/1637633#M1845</guid>
      <dc:creator>RavindraSingh</dc:creator>
      <dc:date>2025-07-30T14:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: Delete in a table1 does not set the value as null in featureclass1, due to another conflicting update rule in featureclass.</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/delete-in-a-table1-does-not-set-the-value-as-null/m-p/1637682#M1846</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/6481"&gt;@RavindraSingh&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Is the ultimate goal to have it so that you have a 1:1 corresponding updates so that when one associated record is changed then the other matching record is also changed. It might be easier for anyone to help troubleshoot your issue if you provide a clear expectation/outcome you wish to have.&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Example: &lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT size="2"&gt;I want the associated record with matching attributes in Tables A and B that update one another&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="2"&gt;Table A has [x,y,z] fields and Table B has [a,b,c] fields&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="2"&gt;Fields x and a have 123 as matching attributes and fields y and b have 789 as matching attributes&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="2"&gt;The expected behavior is:&lt;/FONT&gt;&lt;BR /&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT size="2"&gt;When a record in &lt;STRONG&gt;Table A&lt;/STRONG&gt; is deleted, the associated attribute in&lt;STRONG&gt; field a&lt;/STRONG&gt; of&amp;nbsp;&lt;STRONG&gt;Table B&lt;/STRONG&gt; is set to null&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="2"&gt;When &lt;STRONG&gt;field b&lt;/STRONG&gt; of&amp;nbsp;&lt;STRONG&gt;Table B&lt;/STRONG&gt;&amp;nbsp;is updated and the associated attribute in &lt;STRONG&gt;field y&lt;/STRONG&gt; of&amp;nbsp;&lt;STRONG&gt;Table A&lt;/STRONG&gt; is populated, populate &lt;STRONG&gt;field b&lt;/STRONG&gt; of&amp;nbsp;&lt;STRONG&gt;Table B&amp;nbsp;&lt;/STRONG&gt;with the attribute found in&amp;nbsp;&lt;STRONG&gt;field y&lt;/STRONG&gt; of&amp;nbsp;&lt;STRONG&gt;Table A&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;FONT size="3"&gt;You don't have to go into full detail but the more information the better. Sometimes drawing out the logic flow will sometimes help with situations like this.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 16:45:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/delete-in-a-table1-does-not-set-the-value-as-null/m-p/1637682#M1846</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2025-07-30T16:45:08Z</dc:date>
    </item>
  </channel>
</rss>

