<?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 Delete Associations fails in a EditOperation in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/delete-associations-fails-in-a-editoperation/m-p/1563587#M12342</link>
    <description>&lt;P&gt;I am trying to programmatically delete features&amp;nbsp;in ArcGIS Pro SDK. And if they have associations, I am trying to delete the Associations and then delete the feature using the&amp;nbsp;&amp;nbsp;CreateChainedOperation method. But I get this error. What am I doing wrong?&lt;/P&gt;&lt;P&gt;Even the Delete Associations did not work when tried separately even without chaining&lt;/P&gt;&lt;P&gt;Any advice on this will be much appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rohanrajan_hms_0-1733118803496.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/120628i665A28109B113682/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rohanrajan_hms_0-1733118803496.png" alt="rohanrajan_hms_0-1733118803496.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EditOperation deleteAssociationOperation = new();&lt;BR /&gt;deleteAssociationOperation.Callback(context =&amp;gt; {&lt;/P&gt;&lt;P&gt;foreach (var assoc in assocs)&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;LogMessage($"Deleting Association: {assoc.Type}");&lt;BR /&gt;context.Invalidate(row);&lt;BR /&gt;AssociationDescription associationToDelete = new(assoc.Type, new RowHandle(assoc.FromElement, UN), new RowHandle(assoc.ToElement, UN));&lt;BR /&gt;deleteAssociationOperation.Delete(associationToDelete);&lt;BR /&gt;context.Invalidate(row);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}, enterpriseTable);&lt;BR /&gt;bool resultdelAssoc = await deleteAssociationOperation.ExecuteAsync();&lt;BR /&gt;if (!resultdelAssoc)&lt;BR /&gt;{&lt;BR /&gt;//MessageBox.Show(String.Format($"Could not delete features {row.GetGlobalID()}: {deleteRecordOperation.ErrorMessage}"));&lt;BR /&gt;LogMessage($"Could not delete Association {row.GetGlobalID()}: {deleteAssociationOperation.ErrorMessage}");&lt;BR /&gt;}&lt;BR /&gt;//deleteAssociationOperation.Execute();&lt;/P&gt;&lt;P&gt;else if (resultdelAssoc)&lt;BR /&gt;{&lt;BR /&gt;LogMessage("Deleting Associations Complete, Deleting Feature");&lt;BR /&gt;var chaineddeleteRecordOperation = deleteAssociationOperation.CreateChainedOperation();&lt;BR /&gt;// In order to update the Map and/or the attribute table. Has to be called before the delete.&lt;BR /&gt;chaineddeleteRecordOperation.Callback(context =&amp;gt; {&lt;BR /&gt;context.Invalidate(row);&lt;BR /&gt;chaineddeleteRecordOperation.Delete(row);&lt;BR /&gt;context.Invalidate(row);&lt;BR /&gt;}, enterpriseTable);&lt;/P&gt;&lt;P&gt;bool resultDel = await chaineddeleteRecordOperation.ExecuteAsync();&lt;BR /&gt;if (!resultDel)&lt;BR /&gt;{&lt;BR /&gt;//MessageBox.Show(String.Format($"Could not delete features {row.GetGlobalID()}: {deleteRecordOperation.ErrorMessage}"));&lt;BR /&gt;LogMessage($"Could not delete features {row.GetGlobalID()}: {chaineddeleteRecordOperation.ErrorMessage}");&lt;BR /&gt;}&lt;BR /&gt;else if (resultDel)&lt;BR /&gt;{&lt;BR /&gt;LogMessage("Delete with Association Done");&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Mon, 02 Dec 2024 05:57:22 GMT</pubDate>
    <dc:creator>rohanrajan_hms</dc:creator>
    <dc:date>2024-12-02T05:57:22Z</dc:date>
    <item>
      <title>Delete Associations fails in a EditOperation</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/delete-associations-fails-in-a-editoperation/m-p/1563587#M12342</link>
      <description>&lt;P&gt;I am trying to programmatically delete features&amp;nbsp;in ArcGIS Pro SDK. And if they have associations, I am trying to delete the Associations and then delete the feature using the&amp;nbsp;&amp;nbsp;CreateChainedOperation method. But I get this error. What am I doing wrong?&lt;/P&gt;&lt;P&gt;Even the Delete Associations did not work when tried separately even without chaining&lt;/P&gt;&lt;P&gt;Any advice on this will be much appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rohanrajan_hms_0-1733118803496.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/120628i665A28109B113682/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rohanrajan_hms_0-1733118803496.png" alt="rohanrajan_hms_0-1733118803496.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EditOperation deleteAssociationOperation = new();&lt;BR /&gt;deleteAssociationOperation.Callback(context =&amp;gt; {&lt;/P&gt;&lt;P&gt;foreach (var assoc in assocs)&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;LogMessage($"Deleting Association: {assoc.Type}");&lt;BR /&gt;context.Invalidate(row);&lt;BR /&gt;AssociationDescription associationToDelete = new(assoc.Type, new RowHandle(assoc.FromElement, UN), new RowHandle(assoc.ToElement, UN));&lt;BR /&gt;deleteAssociationOperation.Delete(associationToDelete);&lt;BR /&gt;context.Invalidate(row);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}, enterpriseTable);&lt;BR /&gt;bool resultdelAssoc = await deleteAssociationOperation.ExecuteAsync();&lt;BR /&gt;if (!resultdelAssoc)&lt;BR /&gt;{&lt;BR /&gt;//MessageBox.Show(String.Format($"Could not delete features {row.GetGlobalID()}: {deleteRecordOperation.ErrorMessage}"));&lt;BR /&gt;LogMessage($"Could not delete Association {row.GetGlobalID()}: {deleteAssociationOperation.ErrorMessage}");&lt;BR /&gt;}&lt;BR /&gt;//deleteAssociationOperation.Execute();&lt;/P&gt;&lt;P&gt;else if (resultdelAssoc)&lt;BR /&gt;{&lt;BR /&gt;LogMessage("Deleting Associations Complete, Deleting Feature");&lt;BR /&gt;var chaineddeleteRecordOperation = deleteAssociationOperation.CreateChainedOperation();&lt;BR /&gt;// In order to update the Map and/or the attribute table. Has to be called before the delete.&lt;BR /&gt;chaineddeleteRecordOperation.Callback(context =&amp;gt; {&lt;BR /&gt;context.Invalidate(row);&lt;BR /&gt;chaineddeleteRecordOperation.Delete(row);&lt;BR /&gt;context.Invalidate(row);&lt;BR /&gt;}, enterpriseTable);&lt;/P&gt;&lt;P&gt;bool resultDel = await chaineddeleteRecordOperation.ExecuteAsync();&lt;BR /&gt;if (!resultDel)&lt;BR /&gt;{&lt;BR /&gt;//MessageBox.Show(String.Format($"Could not delete features {row.GetGlobalID()}: {deleteRecordOperation.ErrorMessage}"));&lt;BR /&gt;LogMessage($"Could not delete features {row.GetGlobalID()}: {chaineddeleteRecordOperation.ErrorMessage}");&lt;BR /&gt;}&lt;BR /&gt;else if (resultDel)&lt;BR /&gt;{&lt;BR /&gt;LogMessage("Delete with Association Done");&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2024 05:57:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/delete-associations-fails-in-a-editoperation/m-p/1563587#M12342</guid>
      <dc:creator>rohanrajan_hms</dc:creator>
      <dc:date>2024-12-02T05:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Associations fails in a EditOperation</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/delete-associations-fails-in-a-editoperation/m-p/1563619#M12343</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As written in &lt;A href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Editing#edit-operation-callback" target="_self"&gt;ArcGIS Pro ProConcepts Editing&lt;/A&gt;,&amp;nbsp;&lt;SPAN&gt;you cannot use edit operation methods within the context of your call back routine or lambda. You use Delete method of EditOperation.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2024 09:32:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/delete-associations-fails-in-a-editoperation/m-p/1563619#M12343</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2024-12-02T09:32:36Z</dc:date>
    </item>
  </channel>
</rss>

