<?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: Deleting a feature using arcade - help with code in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/deleting-a-feature-using-arcade-help-with-code/m-p/1546999#M89013</link>
    <description>&lt;P&gt;The below works for me when I recreate your situation above, assuming you only want to delete the first point found with a matching ID to the polygon, and not any subsequent ones.&lt;/P&gt;&lt;P&gt;Other than some line formatting, I think the &lt;STRONG&gt;only difference&lt;/STRONG&gt; between mine and yours is that I am &lt;STRONG&gt;explicitly creating the var "delete" dictionary using the "Dictionary()" constructor&lt;/STRONG&gt; on line 14. I have had a similar problem when loading things into these return keyword dictionaries as you are doing, no idea why, but this has fixed my issue. At this point I pretty much always try to use the explicit constructor when I am able to.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// henter teig_id fra tilknytningspunkt som slettes
var teig_id = $feature.Teig_ID

var fs_tilknytningspunkter = FeatureSetByName($datastore, "Tilknytningspunkter", ["GlobalID", "TEIG_ID"])

var tilknytningspunkt = First(Filter(fs_tilknytningspunkter, "TEIG_ID=@teig_id"))
Console(tilknytningspunkt)
var deleteList = []

if (tilknytningspunkt == null) {
    return
} else {
    // ***ONLY DIFFERENCE?***
    var delete = Dictionary('globalID', tilknytningspunkt.GlobalID)
    Push(deleteList, delete)
}
Console(deleteList)

return {
    'edit': [{
        'className': 'Tilknytningspunkter',
        'deletes': deleteList
    }]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Oct 2024 14:22:02 GMT</pubDate>
    <dc:creator>VinceE</dc:creator>
    <dc:date>2024-10-09T14:22:02Z</dc:date>
    <item>
      <title>Deleting a feature using arcade - help with code</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/deleting-a-feature-using-arcade-help-with-code/m-p/1545529#M88889</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;I'm struggeling with an attribute rule (Calculation) in ArcGIS Pro. I have a two featureclasses in a filegeodatabase (Vegteig - polygon, Tilknytningspunkt - point). The polygonclass has an ID (Teig_ID) which is used as a foreign key in the point class. When I delete a polygon, I want the corresponding point to be deleted as well. I've created an attribute rule on the polygonclass which triggers on delete and have turned on "exclude from application evaluation".&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// henter teig_id fra tilknytningspunkt som slettes
var teig_id = $feature.Teig_ID

var fs_tilknytningspunkter = FeatureSetByName($datastore, "Tilknytningspunkter", ["GlobalID", "TEIG_ID"])

var tilknytningspunkt = First(Filter(fs_tilknytningspunkter, "TEIG_ID=@teig_id"))
Console(tilknytningspunkt)
var deleteList = []

if(tilknytningspunkt == null){
    return
}
else{
    var delete = {'globalId': tilknytningspunkt.GlobalID}
    Push(deleteList, delete)
}
Console(deleteList)

return
{
    'edit': [{
        'className': 'Tilknytningspunkter',
        'deletes': deleteList
    }]
}&lt;/LI-CODE&gt;&lt;P&gt;This code seems to be working fine, as it's verified ok and I can see that point is being selected in the output to console. The problem is that the delete it self is not executed. The polygon is deleted, but the poit still remains.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone see what's wrong?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2024 12:17:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/deleting-a-feature-using-arcade-help-with-code/m-p/1545529#M88889</guid>
      <dc:creator>TorbjørnDalløkken2</dc:creator>
      <dc:date>2024-10-04T12:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting a feature using arcade - help with code</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/deleting-a-feature-using-arcade-help-with-code/m-p/1545683#M88910</link>
      <description>&lt;P&gt;Not as familiar with the ins and outs of Arcade, but in most languages testing for null is done with 'is', not '=='&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2024 16:24:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/deleting-a-feature-using-arcade-help-with-code/m-p/1545683#M88910</guid>
      <dc:creator>ZenMasterZeke</dc:creator>
      <dc:date>2024-10-04T16:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting a feature using arcade - help with code</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/deleting-a-feature-using-arcade-help-with-code/m-p/1546999#M89013</link>
      <description>&lt;P&gt;The below works for me when I recreate your situation above, assuming you only want to delete the first point found with a matching ID to the polygon, and not any subsequent ones.&lt;/P&gt;&lt;P&gt;Other than some line formatting, I think the &lt;STRONG&gt;only difference&lt;/STRONG&gt; between mine and yours is that I am &lt;STRONG&gt;explicitly creating the var "delete" dictionary using the "Dictionary()" constructor&lt;/STRONG&gt; on line 14. I have had a similar problem when loading things into these return keyword dictionaries as you are doing, no idea why, but this has fixed my issue. At this point I pretty much always try to use the explicit constructor when I am able to.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// henter teig_id fra tilknytningspunkt som slettes
var teig_id = $feature.Teig_ID

var fs_tilknytningspunkter = FeatureSetByName($datastore, "Tilknytningspunkter", ["GlobalID", "TEIG_ID"])

var tilknytningspunkt = First(Filter(fs_tilknytningspunkter, "TEIG_ID=@teig_id"))
Console(tilknytningspunkt)
var deleteList = []

if (tilknytningspunkt == null) {
    return
} else {
    // ***ONLY DIFFERENCE?***
    var delete = Dictionary('globalID', tilknytningspunkt.GlobalID)
    Push(deleteList, delete)
}
Console(deleteList)

return {
    'edit': [{
        'className': 'Tilknytningspunkter',
        'deletes': deleteList
    }]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 14:22:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/deleting-a-feature-using-arcade-help-with-code/m-p/1546999#M89013</guid>
      <dc:creator>VinceE</dc:creator>
      <dc:date>2024-10-09T14:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting a feature using arcade - help with code</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/deleting-a-feature-using-arcade-help-with-code/m-p/1547022#M89016</link>
      <description>&lt;P&gt;Arcade uses "==" as it is written to test for null specifically. IsEmpty() is used frequently as well, but that will also return true for empty strings.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 14:47:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/deleting-a-feature-using-arcade-help-with-code/m-p/1547022#M89016</guid>
      <dc:creator>VinceE</dc:creator>
      <dc:date>2024-10-09T14:47:56Z</dc:date>
    </item>
  </channel>
</rss>

