<?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 to modify a different attribute in a different feature than the triggering feature and field in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-modify-a-different-attribute-in/m-p/1652465#M99121</link>
    <description>&lt;P&gt;You want a &lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-keywords.htm" target="_blank" rel="noopener"&gt;dictionary keyword&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;You can use them to edit the current feature, another feature in the same table, or one or more features in a different table or tables entirely.&lt;/P&gt;&lt;P&gt;Crucially, when setting up the rule, don't set it on any field for the output.&lt;/P&gt;&lt;P&gt;Here's an example of a rule that buffers a line automatically, updating any buffer that already exists as well as doing a field calculation on the feature to transform the measurement from feet to meters and miles.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;//Reference: https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-keywords.htm
var rels = FeatureSetByRelationshipName($feature, "rowlines_rowbuffs", ["GlobalID"])
// Get list of buffers to be updated
var ups = []
var miles = $feature.Buffer_size_ft/5280
var meters = $feature.Buffer_size_ft *.3048
for (var rel in rels){
    Push(ups, rel["globalID"])
}
// Return if the buffer field is empty
if (isEmpty($feature.Buffer_size_ft)){
    return
}
// Buffer line by buffer field.
var geo = Geometry($feature)
geo = Buffer(geo, $feature.Buffer_size_ft, "feet")

// This part is tricky
// Construct pieces of your return dictionary
// Assume that it will be adding, like the other three attribute rules before this. 
var edit = [{"attributes": {"Serial_Num": $feature.Serial_Num, 
                                                  "Buffer_size_ft": $feature.Buffer_size_ft,
                                                  "relUUID": $feature.GlobalID
                                                 },
                                    "geometry": geo
                                   }]
var edittype = "adds"

// However, if there's already a buffer, change the dictionary 
// to be updates and specify which record you want.
if (Count(ups)&amp;gt;0){
    edit = [{"globalID" : ups[0], // In this case, we only want one buffer per line, 
                                  // so there should only be one in the list.
             "attributes": {"Serial_Num": $feature.Serial_Num, 
                            "Buffer_size_ft": $feature.Buffer_size_ft,
                            "relUUID": $feature.GlobalID
                                                 },
                             "geometry": geo
                             }]
    edittype = "updates"
}

// Create the return dictionary with instructions to populate two different fields
// then add in the editing instructions from above.
var retDict = {
               "result": {"attributes": {"Buffer_meter": meters,
                                         "Buffer_miles": miles,}
                          },
               "edit": [{"className": "rowbuffs"}]}
// I have to do it this way because if you just add in 
// edittype:edit, it thinks the key is "edittype"
retDict["edit"][0][edittype] = edit
console(retDict)
/*
retDict = {"result": {"attributes": {"Buffer_meter": meters,
                                     "Buffer_miles": miles,}
                          },
           "edit": [{"className": "rowbuffs",
                     "updates": [{"globalID" : ups[0],
                                  "attributes": {
                                                 "Serial_Num": $feature.Serial_Num, 
                                                 "Buffer_size_ft": $feature.Buffer_size_ft,
                                                 "relUUID": $feature.GlobalID
                                                 },
                                  "geometry": geo
                                  }]
                    }]
          }
*/
return retDict&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a file GDB (&amp;gt;=3.5) where this rule was used, as well as several rules that were earlier versions of this rule. The rules are mostly in order but reordering them is really hard so I kind of gave up.&lt;/P&gt;&lt;P&gt;It should be&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;GenerateID (was just testing this rule out, you can ignore it)&lt;OL&gt;&lt;LI&gt;This is the only reason this geodatabase needs to be in 3.5, because the rule was introduced in this version. Everything else can be at Version&amp;gt;=2.7&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;Calculate meters solo&lt;/LI&gt;&lt;LI&gt;Calculate miles solo&lt;/LI&gt;&lt;LI&gt;Meters and miles together&lt;/LI&gt;&lt;LI&gt;Buffers no limits (make a new buffer each time the geometry changes)&lt;/LI&gt;&lt;LI&gt;buffers delete (delete and replace the buffer when the geometry changes)&lt;/LI&gt;&lt;LI&gt;buffers&amp;nbsp; add and update (add or update buffer when geometry changes)&lt;/LI&gt;&lt;LI&gt;Buffers add and update, calc different units (see above)&lt;/LI&gt;&lt;/OL&gt;</description>
    <pubDate>Tue, 23 Sep 2025 15:01:25 GMT</pubDate>
    <dc:creator>AlfredBaldenweck</dc:creator>
    <dc:date>2025-09-23T15:01:25Z</dc:date>
    <item>
      <title>Attribute rule to modify a different attribute in a different feature than the triggering feature and field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-modify-a-different-attribute-in/m-p/1652293#M99107</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Scenario: I have a feature class and two different subtypes A and B, these two subtypes are related in a way that field 'source_id' will have the id of a source feature in subtype A and that id (123) will be populated in the 'source' field of the subtype B features.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;And there is a field 'children' in subtype A that has the count of the features with 'source = 123' will be populated in the field 'children'.&lt;/P&gt;&lt;P&gt;So I tried creating an attribute rule that does this&lt;/P&gt;&lt;P&gt;&amp;nbsp;1. Upon INSERT/UPDATE/DELETE&lt;/P&gt;&lt;P&gt;2. If any one of the subtype B features gets inserted or updated or deleted 'source = 456'&lt;/P&gt;&lt;P&gt;3. I get a featureset where&amp;nbsp;'subtype = B And source = 456' and get the count of the returned features&amp;nbsp;&lt;/P&gt;&lt;P&gt;4. Get the featureset where 'subtype = A And source_id = 456' and populate the count in the field 'children'&lt;/P&gt;&lt;P&gt;Problem:&amp;nbsp;&lt;/P&gt;&lt;P&gt;The field children in the triggering feature (subtype = B) gets updated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Q. How do I configure my attribute rule so that I can get trigger from one feature and make edits through attribute rule in another feature&lt;/P&gt;</description>
      <pubDate>Tue, 23 Sep 2025 03:21:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-modify-a-different-attribute-in/m-p/1652293#M99107</guid>
      <dc:creator>Rohanrajan</dc:creator>
      <dc:date>2025-09-23T03:21:09Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule to modify a different attribute in a different feature than the triggering feature and field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-modify-a-different-attribute-in/m-p/1652461#M99119</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/704032"&gt;@Rohanrajan&lt;/a&gt;&amp;nbsp;- I "think" this example &lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-script-expression.htm#anchor4" target="_self"&gt;"edit another feature class with a calculation rule"&lt;/A&gt; would be a good start to write the script.&amp;nbsp; The key is the 'edit' keyword as described here -&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-keywords.htm#ESRI_SECTION1_98D8C1A03B0D4BAB810DCC76DBA88F2C" target="_blank"&gt;Attribute rule dictionary keywords—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Sep 2025 14:48:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-modify-a-different-attribute-in/m-p/1652461#M99119</guid>
      <dc:creator>Robert_LeClair</dc:creator>
      <dc:date>2025-09-23T14:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule to modify a different attribute in a different feature than the triggering feature and field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-modify-a-different-attribute-in/m-p/1652465#M99121</link>
      <description>&lt;P&gt;You want a &lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-keywords.htm" target="_blank" rel="noopener"&gt;dictionary keyword&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;You can use them to edit the current feature, another feature in the same table, or one or more features in a different table or tables entirely.&lt;/P&gt;&lt;P&gt;Crucially, when setting up the rule, don't set it on any field for the output.&lt;/P&gt;&lt;P&gt;Here's an example of a rule that buffers a line automatically, updating any buffer that already exists as well as doing a field calculation on the feature to transform the measurement from feet to meters and miles.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;//Reference: https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-keywords.htm
var rels = FeatureSetByRelationshipName($feature, "rowlines_rowbuffs", ["GlobalID"])
// Get list of buffers to be updated
var ups = []
var miles = $feature.Buffer_size_ft/5280
var meters = $feature.Buffer_size_ft *.3048
for (var rel in rels){
    Push(ups, rel["globalID"])
}
// Return if the buffer field is empty
if (isEmpty($feature.Buffer_size_ft)){
    return
}
// Buffer line by buffer field.
var geo = Geometry($feature)
geo = Buffer(geo, $feature.Buffer_size_ft, "feet")

// This part is tricky
// Construct pieces of your return dictionary
// Assume that it will be adding, like the other three attribute rules before this. 
var edit = [{"attributes": {"Serial_Num": $feature.Serial_Num, 
                                                  "Buffer_size_ft": $feature.Buffer_size_ft,
                                                  "relUUID": $feature.GlobalID
                                                 },
                                    "geometry": geo
                                   }]
var edittype = "adds"

// However, if there's already a buffer, change the dictionary 
// to be updates and specify which record you want.
if (Count(ups)&amp;gt;0){
    edit = [{"globalID" : ups[0], // In this case, we only want one buffer per line, 
                                  // so there should only be one in the list.
             "attributes": {"Serial_Num": $feature.Serial_Num, 
                            "Buffer_size_ft": $feature.Buffer_size_ft,
                            "relUUID": $feature.GlobalID
                                                 },
                             "geometry": geo
                             }]
    edittype = "updates"
}

// Create the return dictionary with instructions to populate two different fields
// then add in the editing instructions from above.
var retDict = {
               "result": {"attributes": {"Buffer_meter": meters,
                                         "Buffer_miles": miles,}
                          },
               "edit": [{"className": "rowbuffs"}]}
// I have to do it this way because if you just add in 
// edittype:edit, it thinks the key is "edittype"
retDict["edit"][0][edittype] = edit
console(retDict)
/*
retDict = {"result": {"attributes": {"Buffer_meter": meters,
                                     "Buffer_miles": miles,}
                          },
           "edit": [{"className": "rowbuffs",
                     "updates": [{"globalID" : ups[0],
                                  "attributes": {
                                                 "Serial_Num": $feature.Serial_Num, 
                                                 "Buffer_size_ft": $feature.Buffer_size_ft,
                                                 "relUUID": $feature.GlobalID
                                                 },
                                  "geometry": geo
                                  }]
                    }]
          }
*/
return retDict&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a file GDB (&amp;gt;=3.5) where this rule was used, as well as several rules that were earlier versions of this rule. The rules are mostly in order but reordering them is really hard so I kind of gave up.&lt;/P&gt;&lt;P&gt;It should be&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;GenerateID (was just testing this rule out, you can ignore it)&lt;OL&gt;&lt;LI&gt;This is the only reason this geodatabase needs to be in 3.5, because the rule was introduced in this version. Everything else can be at Version&amp;gt;=2.7&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;Calculate meters solo&lt;/LI&gt;&lt;LI&gt;Calculate miles solo&lt;/LI&gt;&lt;LI&gt;Meters and miles together&lt;/LI&gt;&lt;LI&gt;Buffers no limits (make a new buffer each time the geometry changes)&lt;/LI&gt;&lt;LI&gt;buffers delete (delete and replace the buffer when the geometry changes)&lt;/LI&gt;&lt;LI&gt;buffers&amp;nbsp; add and update (add or update buffer when geometry changes)&lt;/LI&gt;&lt;LI&gt;Buffers add and update, calc different units (see above)&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Tue, 23 Sep 2025 15:01:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-modify-a-different-attribute-in/m-p/1652465#M99121</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2025-09-23T15:01:25Z</dc:date>
    </item>
  </channel>
</rss>

