<?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: Check features after edit in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/check-features-after-edit/m-p/1236819#M9133</link>
    <description>&lt;P&gt;Hi Mody,&lt;/P&gt;&lt;P&gt;I'm not an expert on editing events, so I cannot really comment on your code.&lt;/P&gt;&lt;P&gt;Just wanted to ask if you'd had a chance to look into&amp;nbsp;attribute rules? &amp;nbsp;These are rules written in Arcade script that fire during the editing process. &amp;nbsp;You can write constraint rules, which allow checks to take place before an edit is accepted, and calculation rules, which fill in data values. &amp;nbsp;&lt;/P&gt;&lt;P&gt;It sounds like a perfect match for your requirements, although there many be other circumstances which prevent them from working for you.&lt;/P&gt;&lt;P&gt;--Rich&lt;/P&gt;</description>
    <pubDate>Thu, 01 Dec 2022 15:32:36 GMT</pubDate>
    <dc:creator>RichRuh</dc:creator>
    <dc:date>2022-12-01T15:32:36Z</dc:date>
    <item>
      <title>Check features after edit</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/check-features-after-edit/m-p/1236773#M9132</link>
      <description>&lt;P&gt;I am trying to get the OnEditCompleted event and do some checks (is the operation allowed) and actions (calc some default values).&lt;/P&gt;&lt;P&gt;The basic code is below. I have a few questions:&lt;/P&gt;&lt;P&gt;1) Do I need to get the OnRowCreated event too or this event is covering the same operations. Keep in mind that I have to check features added by GP tools (like append).&lt;/P&gt;&lt;P&gt;2) From my debug it looks that even this event is called multiply times with no reason - what can I do about it?&lt;/P&gt;&lt;P&gt;3) I could not find the way to abort the transaction.&amp;nbsp; I could not find something like&amp;nbsp;RowChangedEventArgs.CancelEdit&lt;/P&gt;&lt;P&gt;I used&amp;nbsp;EditCompletedEventArgs.FromException but it create Exception and does not end transaction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Mody&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;protected Task onEditCompleted(EditCompletedEventArgs args)
        {
            // check features one by one
            string message = "";
            Dictionary&amp;lt;MapMember, List&amp;lt;long&amp;gt;&amp;gt; createSelset = args.Creates.ToDictionary();
            foreach (var v in createSelset)
            {
                QueryFilter queryFilter = new QueryFilter();
                queryFilter.ObjectIDs = v.Value;
                FeatureLayer featureLayer = v.Key as FeatureLayer;                
                using (FeatureClass featureClass = featureLayer.GetFeatureClass())
                {
                    using (RowCursor cursor = featureLayer.GetFeatureClass().Search(queryFilter))
                    {
                        Feature currentFeat = null;
                        while (cursor.MoveNext())
                        {
                            currentFeat = (Feature)cursor.Current;
                            bool res = CheckFeatureCreate(currentFeat, out message);
                            if (res == false)
                            {
                                return Task.FromException(new Exception(message));
                            }
                            res = HandleFeatureCreate(currentFeat);
                            if (res == false)
                            {
                                return Task.FromException(new Exception("Problem with calc values"));
                            }
                        }  
                    }
                }
            }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2022 13:41:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/check-features-after-edit/m-p/1236773#M9132</guid>
      <dc:creator>mody_buchbinder</dc:creator>
      <dc:date>2022-12-01T13:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: Check features after edit</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/check-features-after-edit/m-p/1236819#M9133</link>
      <description>&lt;P&gt;Hi Mody,&lt;/P&gt;&lt;P&gt;I'm not an expert on editing events, so I cannot really comment on your code.&lt;/P&gt;&lt;P&gt;Just wanted to ask if you'd had a chance to look into&amp;nbsp;attribute rules? &amp;nbsp;These are rules written in Arcade script that fire during the editing process. &amp;nbsp;You can write constraint rules, which allow checks to take place before an edit is accepted, and calculation rules, which fill in data values. &amp;nbsp;&lt;/P&gt;&lt;P&gt;It sounds like a perfect match for your requirements, although there many be other circumstances which prevent them from working for you.&lt;/P&gt;&lt;P&gt;--Rich&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2022 15:32:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/check-features-after-edit/m-p/1236819#M9133</guid>
      <dc:creator>RichRuh</dc:creator>
      <dc:date>2022-12-01T15:32:36Z</dc:date>
    </item>
    <item>
      <title>Re: Check features after edit</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/check-features-after-edit/m-p/1236886#M9137</link>
      <description>&lt;P&gt;Mody, EditCompletedEvent fires _after_ the fact, when the transaction has completed so it cannot be cancelled as it is not longer running. You may want to look at the EditCompletingEvent which also provides a CancelEdit capability. It is explained here:&amp;nbsp;&lt;A href="https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Editing#editcompletingevent" target="_blank"&gt;https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Editing#editcompletingevent.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;API Reference:&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic20522.html" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic20522.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2022 17:41:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/check-features-after-edit/m-p/1236886#M9137</guid>
      <dc:creator>CharlesMacleod</dc:creator>
      <dc:date>2022-12-01T17:41:01Z</dc:date>
    </item>
    <item>
      <title>Re: Check features after edit</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/check-features-after-edit/m-p/1237569#M9143</link>
      <description>&lt;P&gt;Good answer by Charlie (as usual).&lt;/P&gt;&lt;P&gt;The limit we try to force is that the user can not add/change/delete more then X number of features in one operation.&lt;/P&gt;&lt;P&gt;I do not see any way to do it using attribute rules since they work one by one.&lt;/P&gt;&lt;P&gt;In face we cannot use OnRowCreated for the same reason.&lt;/P&gt;&lt;P&gt;Do you see any reason to subscribe to OnRowCreate if we subscribe to&amp;nbsp;&lt;SPAN&gt;EditCompletingEvent - is there any case that not both of them is called?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Dec 2022 06:40:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/check-features-after-edit/m-p/1237569#M9143</guid>
      <dc:creator>mody_buchbinder</dc:creator>
      <dc:date>2022-12-04T06:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: Check features after edit</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/check-features-after-edit/m-p/1237888#M9146</link>
      <description>&lt;P&gt;Hi Mody, I think it just depends on what your workflow requirements are. The EditCompletingEvent, imo, could be useful if you are tracking specific edit operations (typically that u initiate) and u are doing some broad-based validation or even auditing/logging.&lt;/P&gt;&lt;P&gt;The ROW events are much more granular than the EditCompletingEvent event - they will fire any time an edit occurs against a dataset (for which u register for events). They also contain the row being edited which makes them useful for "final" validation of a specific feature or other business logic that wants to change an attribute value before the "Store" completes.&lt;/P&gt;&lt;P&gt;The event to be the most judicious with will be the ROW event given how frequently it could fire during an edit (that spans multiple rows and multiple datasets - if u r registered against many datasets).&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 17:39:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/check-features-after-edit/m-p/1237888#M9146</guid>
      <dc:creator>CharlesMacleod</dc:creator>
      <dc:date>2022-12-05T17:39:48Z</dc:date>
    </item>
  </channel>
</rss>

