<?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: How to Delete Records in Related Table in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/how-to-delete-records-in-related-table/m-p/1141130#M309</link>
    <description>&lt;P&gt;Hi Johannes,&lt;/P&gt;&lt;P&gt;Thanks for the reply. You are right about the array of dictionaries, I didn't think about looping the feature set of related records to create the dictionary.&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;</description>
    <pubDate>Mon, 07 Feb 2022 12:43:48 GMT</pubDate>
    <dc:creator>Billy</dc:creator>
    <dc:date>2022-02-07T12:43:48Z</dc:date>
    <item>
      <title>How to Delete Records in Related Table</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/how-to-delete-records-in-related-table/m-p/1140761#M307</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;This is my system configuration:&lt;/P&gt;&lt;P&gt;- Arcgis Enterprise 10.8.1&lt;/P&gt;&lt;P&gt;- Arcgis Pro 2.9.1&lt;/P&gt;&lt;P&gt;- Utility Network version 4&lt;/P&gt;&lt;P&gt;I'm trying to delete multiple records from a related table using Arcade. My plan is to return a dictionary using the keyword "deletes". This keyword accepts 2 parameters: objectID / globalID. My question is: how could I use this keyword to delete multiple records without creating one "deletes" section in the dictionary for every record? Can I pass to "globalID" an array of globalIDs of the feature I want to delete from the related table?&lt;/P&gt;&lt;P&gt;Also, my parent feature have several records in the related table but I only need to delete some of those records, which I can filter using a field in the related table. If I use the function "FeatureSetByRelationshipName" I can get all the records associated with the parent feature as a FeatureSet, then filter the returned FeatureSet to leave only the features that I want to delete. The question then is how to pass all the filtered records to the return dictionary without doing it one at a time?&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;H3&gt;&amp;nbsp;&lt;/H3&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Feb 2022 14:14:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/how-to-delete-records-in-related-table/m-p/1140761#M307</guid>
      <dc:creator>Billy</dc:creator>
      <dc:date>2022-02-04T14:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to Delete Records in Related Table</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/how-to-delete-records-in-related-table/m-p/1141101#M308</link>
      <description>&lt;P&gt;The keywords "adds", "updates", and "deletes" require an array of dictionaries.&lt;/P&gt;&lt;P&gt;The exact requirements for each keyword can be found here:&lt;BR /&gt;&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;Attribute rule dictionary keywords—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"deletes" just requires the globalID/objectID identifying the records that should be deleted:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;return {
  "result": result,
  "edit": [
    {
      "className": "OtherTable",
      "deletes": [
        {"globalID": GlobalID1},
        {"globalID": GlobalID2},
        {"globalID": GlobalID3},
      ]
    }
  ]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You already know how to load and filter the related features, so you just have to put it all together:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// load related features
var related_features = FeatureSetByRelationshipName($feature, "RelationshipName")

// filter related features
var filtered_related_features = Filter(related_features, "Attribute = Value")

// create and fill the deletes array
var deletes = []
for(var f in filtered_related_features) {
  Push(deletes, {"globalID": f.GlobalID})
}

// return
return {
  "edit": [
    {
      "className": "RelatedFeatureClass",
      "deletes": deletes
    }
  ]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Feb 2022 06:11:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/how-to-delete-records-in-related-table/m-p/1141101#M308</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-02-07T06:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to Delete Records in Related Table</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/how-to-delete-records-in-related-table/m-p/1141130#M309</link>
      <description>&lt;P&gt;Hi Johannes,&lt;/P&gt;&lt;P&gt;Thanks for the reply. You are right about the array of dictionaries, I didn't think about looping the feature set of related records to create the dictionary.&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Feb 2022 12:43:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/how-to-delete-records-in-related-table/m-p/1141130#M309</guid>
      <dc:creator>Billy</dc:creator>
      <dc:date>2022-02-07T12:43:48Z</dc:date>
    </item>
  </channel>
</rss>

