<?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 Update Trigger Preventing Field Updates Due to Association Status in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-update-trigger-preventing-field/m-p/1553061#M1615</link>
    <description>&lt;P&gt;Not sure why the update trigger needs to be enabled for this rule but you could just exit early if $feature already has an association. It depends on your particular scenario and what other associations could exist, but it would look something like this&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;if ($editcontext.editType == "UPDATE"){
    var assoc = FeatureSetByAssociation($feature, "container")
    if (Count(assoc) &amp;gt; 0) return
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 28 Oct 2024 22:09:49 GMT</pubDate>
    <dc:creator>TedHoward2</dc:creator>
    <dc:date>2024-10-28T22:09:49Z</dc:date>
    <item>
      <title>Attribute Rule Update Trigger Preventing Field Updates Due to Association Status</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-update-trigger-preventing-field/m-p/1551823#M1610</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I’m encountering an issue with an &lt;STRONG&gt;Attribute Rule&lt;/STRONG&gt; that is designed to establish a containment relationship when a feature is inserted into the &lt;STRONG&gt;main.StructureBoundary&lt;/STRONG&gt; layer. The rule works perfectly for establishing the &lt;STRONG&gt;container&lt;/STRONG&gt; and &lt;STRONG&gt;content&lt;/STRONG&gt; relationships upon feature insertion.&lt;/P&gt;&lt;P&gt;However, when I enable the &lt;STRONG&gt;update trigger&lt;/STRONG&gt;, I face a problem. If I try to update an attribute of a feature that already has an association, the update trigger attempts to re-establish the existing association, leading to the error: &lt;STRONG&gt;"association status already exists."&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;In some cases, I need to update attributes of features that already have an established association. I would like to be able to do this without disabling the update trigger.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Current Rule&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;var sjFeatureSet = FeatureSetByName($datastore, "main.StructureBoundary", ["objectid"] ,false)
// Asset Group 53 (StructureBoundary T_HUCRE Subtypes Code)
// Asset Type 190-191-192 (StructureBoundary T_HUCRE Domain Code)
var T_HUCRE_FeatureSet = Filter(sjFeatureSet, "ASSETGROUP in (53) AND ASSETTYPE in (190,191,192)")
//buffer
var g = buffer($feature, 0)

var intersected_T_HUCRE = Intersects(T_HUCRE_FeatureSet,g)

if (count(intersected_T_HUCRE) == 0)
return $feature.KuralAciklama;

var pole = first(intersected_T_HUCRE)

return {
"edit":
[
{
"className": "main.StructureBoundary",

"updates":
[
{
"objectID": pole.objectid,
"associationType": 'container'
}
]
}
]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Goal:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Keep the &lt;STRONG&gt;update trigger&lt;/STRONG&gt; enabled.&lt;/LI&gt;&lt;LI&gt;Allow attribute updates without triggering the "association status already exists" error.&lt;/LI&gt;&lt;LI&gt;Only attempt to establish a new containment relationship if one does not already exist.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Has anyone encountered a similar issue, or could suggest how I can modify the rule to avoid this problem?&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2024 14:43:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-update-trigger-preventing-field/m-p/1551823#M1610</guid>
      <dc:creator>GIS_Ozzy</dc:creator>
      <dc:date>2024-10-24T14:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule Update Trigger Preventing Field Updates Due to Association Status</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-update-trigger-preventing-field/m-p/1553061#M1615</link>
      <description>&lt;P&gt;Not sure why the update trigger needs to be enabled for this rule but you could just exit early if $feature already has an association. It depends on your particular scenario and what other associations could exist, but it would look something like this&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;if ($editcontext.editType == "UPDATE"){
    var assoc = FeatureSetByAssociation($feature, "container")
    if (Count(assoc) &amp;gt; 0) return
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2024 22:09:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-update-trigger-preventing-field/m-p/1553061#M1615</guid>
      <dc:creator>TedHoward2</dc:creator>
      <dc:date>2024-10-28T22:09:49Z</dc:date>
    </item>
  </channel>
</rss>

