<?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 Is it possible for a PYT tool to notify the ArcMap edit session that edits have been made? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/is-it-possible-for-a-pyt-tool-to-notify-the-arcmap/m-p/638394#M49786</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Crazy technical issue... I'm creating a set of "helper tools" for power editors in an enterprise environment.&amp;nbsp; Ideally the tools will run correctly when the user is "in an arcmap edit session" or not.&amp;nbsp; I'd be fine with forcing them users to only be in an edit session when using the tools but the problem there is that after edits are made by the tool.&amp;nbsp; The arcmap editor doesn't seem to know changes have been made; clicking the "stop editing" button doesn't present the user with the save option and dumps the edits.&amp;nbsp; This is probably an edge case but --- man --- will users be mad if they lose edits and the proper attribution doesn't get pushed during a reconcile/post.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Details below.&amp;nbsp; You can also grab the source file in this repo:&amp;nbsp;&lt;A class="link-titled" href="https://github.com/fspataro/PYT-EditingIssues" title="https://github.com/fspataro/PYT-EditingIssues"&gt;GitHub - fspataro/PYT-EditingIssues: Demostration of issues use ArcGIS PYT tools with an ArcMap edit session&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: underline;"&gt;SETUP&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;SQLServer database&lt;UL&gt;&lt;LI&gt;&amp;nbsp;geodatabase enabled&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Feature dataset&lt;UL&gt;&lt;LI&gt;Feature class&lt;BR /&gt;&lt;UL&gt;&lt;LI&gt;GlobalIds added&lt;/LI&gt;&lt;LI&gt;Editor tracking enabled&lt;/LI&gt;&lt;LI&gt;registered as versioned&lt;/LI&gt;&lt;LI&gt;Archiving Enabled&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Python toolbox (pyt)&lt;UL&gt;&lt;LI&gt;based on template/help sample&lt;/LI&gt;&lt;LI&gt;opens arcpy.da.UpdateCursor&lt;UL&gt;&lt;LI&gt;sets text field to input value&lt;/LI&gt;&lt;LI&gt;updateRow()&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Geoprocessing Options&lt;UL&gt;&lt;LI&gt;Background Processing disabled&lt;/LI&gt;&lt;LI&gt;Note: I re-ran all the test below with "background process enabled" but it doesn't appear to use the background processor for pyt tools. (?)&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;TEST SCENARIO/RESULTS&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If 'ArcMap edit session' is closed, tools fails as expected:&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;EM&gt;"Objects in this class cannot be updated outside an edit session [TestsGDB.DBO.TES_Polygon]"&lt;/EM&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If 'arcmap edit session' is open, tool succeeds, attribute update is visible in table.&lt;UL&gt;&lt;LI&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG style="color: #ff6600; text-decoration: underline;"&gt;However, when clicking "stop editing", there's no warning that edits are pending and the session will close and reset the data.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;/SPAN&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Added arcpy.da.Editor to check if 'isEditing':&lt;UL&gt;&lt;LI&gt;returns false regardless of the&amp;nbsp;ArcMap&amp;nbsp;editor state --- makes sense that it's not the same session&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-centered j-img-original" src="https://community.esri.com/legacyfs/online/429789_editing-false-expected.png" style="display: block; margin-left: auto; margin-right: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-2 j-img-centered jive-image" height="455" src="https://community.esri.com/legacyfs/online/429790_editing-false-not-helpful.png" style="display: block; margin-left: auto; margin-right: auto;" width="774" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Added editor.startOperation() and editor.stopOperation() with the&amp;nbsp;ArcMap edit session open&lt;UL&gt;&lt;LI&gt;fails with "start an edit session"&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-3 j-img-centered j-img-original" src="https://community.esri.com/legacyfs/online/429800_start-operation.png" style="display: block; margin-left: auto; margin-right: auto;" /&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Added editor.startEditing() with the&amp;nbsp;ArcMap edit session open, but no closing editor.stopEditing()&lt;UL&gt;&lt;LI&gt;this produces a successful tool run and the "save edits" dialog prompts when clicking 'stop editing'&lt;/LI&gt;&lt;LI&gt;when the&amp;nbsp;ArcMap edit session is closed, the tool will appear to run successfully but the edits don't persist. This seems logical since I never closed the session.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image j-img-centered image-4 j-img-original" src="https://community.esri.com/legacyfs/online/429801_start-operation.png" style="display: block; margin-left: auto; margin-right: auto;" /&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Adding editor.stopEditing() with the arcmap session open&lt;UL&gt;&lt;LI&gt;this throws an error on the editor.stopEditing() with the message - "start edit session"&lt;/LI&gt;&lt;LI&gt;this result baffles me ????&lt;/LI&gt;&lt;LI&gt;the attribute edits are correctly placed and the "save edits" dialog prompts when clicking 'stop editing'. So it's almost correct behavior except for the "tool failed result"&lt;/LI&gt;&lt;LI&gt;when the&amp;nbsp;ArcMap&amp;nbsp;edit session is closed, the tool will execute as expected and the edits persist&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-5 j-img-centered j-img-original" src="https://community.esri.com/legacyfs/online/429802_stop-editing.png" style="display: block; margin-left: auto; margin-right: auto;" /&gt;&lt;BR /&gt; &lt;BR /&gt; It seems like my choice is use the full script edit session management and sink the error on stopEditing so it works in and out of the ArcMap edit session or don't use the script edit session and the user can only work in an&amp;nbsp;ArcMap session and might not get the prompt.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 Nov 2018 20:26:37 GMT</pubDate>
    <dc:creator>FredSpataro</dc:creator>
    <dc:date>2018-11-16T20:26:37Z</dc:date>
    <item>
      <title>Is it possible for a PYT tool to notify the ArcMap edit session that edits have been made?</title>
      <link>https://community.esri.com/t5/python-questions/is-it-possible-for-a-pyt-tool-to-notify-the-arcmap/m-p/638394#M49786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Crazy technical issue... I'm creating a set of "helper tools" for power editors in an enterprise environment.&amp;nbsp; Ideally the tools will run correctly when the user is "in an arcmap edit session" or not.&amp;nbsp; I'd be fine with forcing them users to only be in an edit session when using the tools but the problem there is that after edits are made by the tool.&amp;nbsp; The arcmap editor doesn't seem to know changes have been made; clicking the "stop editing" button doesn't present the user with the save option and dumps the edits.&amp;nbsp; This is probably an edge case but --- man --- will users be mad if they lose edits and the proper attribution doesn't get pushed during a reconcile/post.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Details below.&amp;nbsp; You can also grab the source file in this repo:&amp;nbsp;&lt;A class="link-titled" href="https://github.com/fspataro/PYT-EditingIssues" title="https://github.com/fspataro/PYT-EditingIssues"&gt;GitHub - fspataro/PYT-EditingIssues: Demostration of issues use ArcGIS PYT tools with an ArcMap edit session&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: underline;"&gt;SETUP&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;SQLServer database&lt;UL&gt;&lt;LI&gt;&amp;nbsp;geodatabase enabled&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Feature dataset&lt;UL&gt;&lt;LI&gt;Feature class&lt;BR /&gt;&lt;UL&gt;&lt;LI&gt;GlobalIds added&lt;/LI&gt;&lt;LI&gt;Editor tracking enabled&lt;/LI&gt;&lt;LI&gt;registered as versioned&lt;/LI&gt;&lt;LI&gt;Archiving Enabled&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Python toolbox (pyt)&lt;UL&gt;&lt;LI&gt;based on template/help sample&lt;/LI&gt;&lt;LI&gt;opens arcpy.da.UpdateCursor&lt;UL&gt;&lt;LI&gt;sets text field to input value&lt;/LI&gt;&lt;LI&gt;updateRow()&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Geoprocessing Options&lt;UL&gt;&lt;LI&gt;Background Processing disabled&lt;/LI&gt;&lt;LI&gt;Note: I re-ran all the test below with "background process enabled" but it doesn't appear to use the background processor for pyt tools. (?)&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;TEST SCENARIO/RESULTS&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If 'ArcMap edit session' is closed, tools fails as expected:&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;EM&gt;"Objects in this class cannot be updated outside an edit session [TestsGDB.DBO.TES_Polygon]"&lt;/EM&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If 'arcmap edit session' is open, tool succeeds, attribute update is visible in table.&lt;UL&gt;&lt;LI&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG style="color: #ff6600; text-decoration: underline;"&gt;However, when clicking "stop editing", there's no warning that edits are pending and the session will close and reset the data.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;/SPAN&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Added arcpy.da.Editor to check if 'isEditing':&lt;UL&gt;&lt;LI&gt;returns false regardless of the&amp;nbsp;ArcMap&amp;nbsp;editor state --- makes sense that it's not the same session&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-centered j-img-original" src="https://community.esri.com/legacyfs/online/429789_editing-false-expected.png" style="display: block; margin-left: auto; margin-right: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-2 j-img-centered jive-image" height="455" src="https://community.esri.com/legacyfs/online/429790_editing-false-not-helpful.png" style="display: block; margin-left: auto; margin-right: auto;" width="774" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Added editor.startOperation() and editor.stopOperation() with the&amp;nbsp;ArcMap edit session open&lt;UL&gt;&lt;LI&gt;fails with "start an edit session"&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-3 j-img-centered j-img-original" src="https://community.esri.com/legacyfs/online/429800_start-operation.png" style="display: block; margin-left: auto; margin-right: auto;" /&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Added editor.startEditing() with the&amp;nbsp;ArcMap edit session open, but no closing editor.stopEditing()&lt;UL&gt;&lt;LI&gt;this produces a successful tool run and the "save edits" dialog prompts when clicking 'stop editing'&lt;/LI&gt;&lt;LI&gt;when the&amp;nbsp;ArcMap edit session is closed, the tool will appear to run successfully but the edits don't persist. This seems logical since I never closed the session.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image j-img-centered image-4 j-img-original" src="https://community.esri.com/legacyfs/online/429801_start-operation.png" style="display: block; margin-left: auto; margin-right: auto;" /&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Adding editor.stopEditing() with the arcmap session open&lt;UL&gt;&lt;LI&gt;this throws an error on the editor.stopEditing() with the message - "start edit session"&lt;/LI&gt;&lt;LI&gt;this result baffles me ????&lt;/LI&gt;&lt;LI&gt;the attribute edits are correctly placed and the "save edits" dialog prompts when clicking 'stop editing'. So it's almost correct behavior except for the "tool failed result"&lt;/LI&gt;&lt;LI&gt;when the&amp;nbsp;ArcMap&amp;nbsp;edit session is closed, the tool will execute as expected and the edits persist&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-5 j-img-centered j-img-original" src="https://community.esri.com/legacyfs/online/429802_stop-editing.png" style="display: block; margin-left: auto; margin-right: auto;" /&gt;&lt;BR /&gt; &lt;BR /&gt; It seems like my choice is use the full script edit session management and sink the error on stopEditing so it works in and out of the ArcMap edit session or don't use the script edit session and the user can only work in an&amp;nbsp;ArcMap session and might not get the prompt.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2018 20:26:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-it-possible-for-a-pyt-tool-to-notify-the-arcmap/m-p/638394#M49786</guid>
      <dc:creator>FredSpataro</dc:creator>
      <dc:date>2018-11-16T20:26:37Z</dc:date>
    </item>
  </channel>
</rss>

