<?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: Refresh a Table View after Append_management in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/refresh-a-table-view-after-append-management/m-p/6510#M564</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; I haven't tried it, but you could try making the table view a derived output (set the script tool parameter type and direction properties) and then using arcpy.setParameterAsText(theTableParameterIndex, theTableVariableName) at the end of your script. I believe, that I have found that this does update existing feature class tables when I add a field (in a script tool) to something that's already open.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the suggestion. I added the derived parameter to the tool as an output. The code threw an error when I used arcpy.&lt;/SPAN&gt;&lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;s&lt;/SPAN&gt;&lt;SPAN&gt;etParameterAsText, but ran when I used arcpy.&lt;/SPAN&gt;&lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;S&lt;/SPAN&gt;&lt;SPAN&gt;etParameterAsText. However, the result was the same as my original tool. If the Table View was closed it showed the appended records and updated record count when I opened the table view. However, the Table View did not refresh after the tool ran if it was open while the tool ran. It also did not refresh when I manually reloaded the table cache. I had to close and reopen it to make it show the appended records and refresh the record count.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the full code I tried, where parameter index 3 is the derived output parameter:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

tblCopyRecords = arcpy.GetParameterAsText(0)
if not arcpy.Exists(tblCopyRecords):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("Invalid Input table provided: " + tblCopyRecords)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
xTimes = int(arcpy.GetParameterAsText(1))

tblPasteRecords = arcpy.GetParameterAsText(2)

if tblPasteRecords == '':
&amp;nbsp;&amp;nbsp;&amp;nbsp; tblPasteRecords = tblCopyRecords

if not arcpy.Exists(tblPasteRecords):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("Invalid Output table provided: " + tblPasteRecords)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
arcpy.CopyRows_management(tblCopyRecords, "in_memory/tblScratch")
for i in range(0, xTimes):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Append_management("in_memory/tblScratch", tblPasteRecords, "NO_TEST")

tblOutput = arcpy.SetParameterAsText(3, tblPasteRecords)

arcpy.RefreshActiveView()&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It seemed like a reasonable approach, unfortunately it does not appear to work.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 20:16:20 GMT</pubDate>
    <dc:creator>RichardFairhurst</dc:creator>
    <dc:date>2021-12-10T20:16:20Z</dc:date>
    <item>
      <title>Refresh a Table View after Append_management</title>
      <link>https://community.esri.com/t5/python-questions/refresh-a-table-view-after-append-management/m-p/6507#M561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to use the Append_management tool in a Python script tool where a table view in ArcMap is the output.&amp;nbsp; The append works, but if the table view is open the appended records won't appear and the record count won't change until I manually close the table view and reopen it.&amp;nbsp; Using arcpy.RefreshActiveView() and reloading the table cache manually does nothing, only manually closing and reopening the table view works.&amp;nbsp; Is there any way to make Python get the table view to refresh without a user having to manually close and reopen the table view?&amp;nbsp; The behavior is the same if I run Append_management directly in ArcMap outside of my script tool.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this a bug in the Append_management tool that needs to be fixed or do I need to add an Idea to the Ideas website requesting that a refresh subroutine be added to the tool or arcpy.RefreshActiveView() that will work when a table view is the output?&amp;nbsp; Is writing my own Append_management routine using a cursor my only option?&amp;nbsp; Will a Python Insertcursor update the table view, or do I need to use a .Net Insertcursor and refresh options to make this work?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is all because ESRI is stupidly refusing to even consider the idea of making a &lt;/SPAN&gt;&lt;A href="https://c.na9.visual.force.com/apex/ideaView?id=0873000000088RZAAY"&gt;Copy/&lt;SPAN style="font-size:6;"&gt;Paste&lt;/SPAN&gt; Rows option available for a StandAlone table&lt;/A&gt;&lt;SPAN&gt;.&amp;nbsp; I resent having to do their work for them with my own tool in the first place, but lame behavioral glitches like this make it that much more frustrating.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 Apr 2014 13:02:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/refresh-a-table-view-after-append-management/m-p/6507#M561</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2014-04-12T13:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh a Table View after Append_management</title>
      <link>https://community.esri.com/t5/python-questions/refresh-a-table-view-after-append-management/m-p/6508#M562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I haven't tried it, but you could try making the table view a derived output (set the script tool parameter type and direction properties) and then using arcpy.setParameterAsText(theTableParameterIndex, theTableVariableName) at the end of your script.&amp;nbsp; I believe, that I have found that this does update existing feature class tables when I add a field (in a script tool) to something that's already open.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 Apr 2014 13:57:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/refresh-a-table-view-after-append-management/m-p/6508#M562</guid>
      <dc:creator>LT</dc:creator>
      <dc:date>2014-04-12T13:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh a Table View after Append_management</title>
      <link>https://community.esri.com/t5/python-questions/refresh-a-table-view-after-append-management/m-p/6509#M563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Richard, I don't know if you've seen this promising post by Duncan Hornby:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/5690-Update-View-of-Attribute-Table-in-ArcMap-(Reload-Cache)#2"&gt;http://forums.arcgis.com/threads/5690-Update-View-of-Attribute-Table-in-ArcMap-(Reload-Cache)#2&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyway, I haven't had time to check it out although I've been itching to....looks like it gets a handle on all the open tables and reloads the cache.&amp;nbsp; Surprised no one has upvoted his post yet.&amp;nbsp; With a knowledge of .NET add-ins, I suppose you 'hinge' a listener to execute for an on-change event -- I'm just not certain how you'd listen for changes in the map (like an Append), but guess you could also simply make an extra button, but then again you already have a 'reload cache' button in the table window.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 Apr 2014 15:15:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/refresh-a-table-view-after-append-management/m-p/6509#M563</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2014-04-12T15:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh a Table View after Append_management</title>
      <link>https://community.esri.com/t5/python-questions/refresh-a-table-view-after-append-management/m-p/6510#M564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; I haven't tried it, but you could try making the table view a derived output (set the script tool parameter type and direction properties) and then using arcpy.setParameterAsText(theTableParameterIndex, theTableVariableName) at the end of your script. I believe, that I have found that this does update existing feature class tables when I add a field (in a script tool) to something that's already open.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the suggestion. I added the derived parameter to the tool as an output. The code threw an error when I used arcpy.&lt;/SPAN&gt;&lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;s&lt;/SPAN&gt;&lt;SPAN&gt;etParameterAsText, but ran when I used arcpy.&lt;/SPAN&gt;&lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;S&lt;/SPAN&gt;&lt;SPAN&gt;etParameterAsText. However, the result was the same as my original tool. If the Table View was closed it showed the appended records and updated record count when I opened the table view. However, the Table View did not refresh after the tool ran if it was open while the tool ran. It also did not refresh when I manually reloaded the table cache. I had to close and reopen it to make it show the appended records and refresh the record count.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the full code I tried, where parameter index 3 is the derived output parameter:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

tblCopyRecords = arcpy.GetParameterAsText(0)
if not arcpy.Exists(tblCopyRecords):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("Invalid Input table provided: " + tblCopyRecords)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
xTimes = int(arcpy.GetParameterAsText(1))

tblPasteRecords = arcpy.GetParameterAsText(2)

if tblPasteRecords == '':
&amp;nbsp;&amp;nbsp;&amp;nbsp; tblPasteRecords = tblCopyRecords

if not arcpy.Exists(tblPasteRecords):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("Invalid Output table provided: " + tblPasteRecords)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
arcpy.CopyRows_management(tblCopyRecords, "in_memory/tblScratch")
for i in range(0, xTimes):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Append_management("in_memory/tblScratch", tblPasteRecords, "NO_TEST")

tblOutput = arcpy.SetParameterAsText(3, tblPasteRecords)

arcpy.RefreshActiveView()&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It seemed like a reasonable approach, unfortunately it does not appear to work.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:16:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/refresh-a-table-view-after-append-management/m-p/6510#M564</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-10T20:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh a Table View after Append_management</title>
      <link>https://community.esri.com/t5/python-questions/refresh-a-table-view-after-append-management/m-p/6511#M565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Richard, I don't know if you've seen this promising post by Duncan Hornby:&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/5690-Update-View-of-Attribute-Table-in-ArcMap-(Reload-Cache)#2"&gt;http://forums.arcgis.com/threads/5690-Update-View-of-Attribute-Table-in-ArcMap-(Reload-Cache)#2&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Anyway, I haven't had time to check it out although I've been itching to....looks like it gets a handle on all the open tables and reloads the cache.&amp;nbsp; Surprised no one has upvoted his post yet.&amp;nbsp; With a knowledge of .NET add-ins, I suppose you 'hinge' a listener to execute for an on-change event -- I'm just not certain how you'd listen for changes in the map (like an Append), but guess you could also simply make an extra button, but then again you already have a 'reload cache' button in the table window.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Wayne&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for this suggestion also.&amp;nbsp; I tried running the code where I just refresh every open table view rather than a specific table view.&amp;nbsp; I ran the Python code that used the Append_management tool and left the table view open.&amp;nbsp; Then I ran Duncan's code.&amp;nbsp; The open table view did not show the appended records or update the record count after Duncan's code successfully ran.&amp;nbsp; I expected this result, since the Reload Cache button also does not work when I press it manuallly.&amp;nbsp; I had to manually close and reopen the table view.&amp;nbsp; If there is an ArcObjects way to close and reopen the table view I could try that, but it appears as long as the table view is open it will not reflect the output of the Append_management tool.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This seems like a bug.&amp;nbsp; If ESRI is going to let me process a tool on an open table view, I ought to have some method of refreshing the table view after the tool runs without requiring a user to manually close and reopen the table view every time.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 Apr 2014 18:38:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/refresh-a-table-view-after-append-management/m-p/6511#M565</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2014-04-12T18:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh a Table View after Append_management</title>
      <link>https://community.esri.com/t5/python-questions/refresh-a-table-view-after-append-management/m-p/6512#M566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I had similar issues with .Net code I wrote that splits LR event records with a mouse click.&amp;nbsp; In that case I ran a cursor against the underlying source table for the event to insert the duplicated records needed to accomplish the split.&amp;nbsp; The only way I got it show anything in the LR Event table was to run a select query after the records were inserted.&amp;nbsp; That worked to make the records appear.&amp;nbsp; However, the actual split would still not be reflected in the actual events displayed on my map screen until I manually changed or recopied over at least one attribute manually in each record.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At least this tool showed me something had changed in the event table without me having to close and reopen it, even if I had to manually touch every record to fully complete the process.&amp;nbsp; I believe that if I ran the Field Calculator to overwrite a field with its existing value I could to force the completion of the event update, but I have not tried that yet.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ESRI's response to this behavior and my request for a way to fully refresh the event table was that they do not support editing event tables and that they had added a warning when the editor is started to indicate that event tables are not editable, even though they are editable.&amp;nbsp; They said I had to convert the events to features to have my edits work, but that defeats my purpose in using event tables in the first place and confirms my view that they think Standalone tables aren't really worth supporting.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;They implied, without actually coming out and saying it, that at some release in the future they will actually fully cripple all event table editing.&amp;nbsp; I suppose they think their warning will wean users from doing event table edits, but that certainly is not the case for me.&amp;nbsp; This is insane and going opposite of what any user should want.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If ESRI actually fully prevents editing of XY and LR event tables at all at some point I hope user complaints go through the roof.&amp;nbsp; If you care about Standalone tables please make your voice heard.&amp;nbsp; Standalone table users need to make ESRI listen to and respect our needs now or we risk losing any functionality for Standalone tables worth having in future downgrades.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 Apr 2014 19:13:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/refresh-a-table-view-after-append-management/m-p/6512#M566</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2014-04-12T19:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh a Table View after Append_management</title>
      <link>https://community.esri.com/t5/python-questions/refresh-a-table-view-after-append-management/m-p/6513#M567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry about the s vs S typo.&amp;nbsp; I don't use that command very often (I prefer sys.argv).&amp;nbsp; But it's too bad that didn't work.&amp;nbsp;&amp;nbsp; I'll throw in one more simplistic suggestion.&amp;nbsp; You could try to get the modified version to open in another instance of Arc (Map? Catalog?).&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Take the SetParameterAsText stuff out and put in an os.startfile(theFileofInterest)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This command launches an instance of the default program associated with that file.&amp;nbsp; I don't think I've tried it with files that are already open in something else. Also, I haven't worked with table views, so I don't know what the default application is.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 Apr 2014 21:43:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/refresh-a-table-view-after-append-management/m-p/6513#M567</guid>
      <dc:creator>LT</dc:creator>
      <dc:date>2014-04-12T21:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh a Table View after Append_management</title>
      <link>https://community.esri.com/t5/python-questions/refresh-a-table-view-after-append-management/m-p/6514#M568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I really don't want to open a new instance of ArcMap even if that would work, since I want the current map to be the output target.&amp;nbsp; I would much prefer to force the table view to close and then reopen it.&amp;nbsp; It would even be acceptable if I could just close the table view so that the user knew something had happened after the tool ran and had to reopen the table view so that the appended records and updated record count would show up.&amp;nbsp; Is there any Python code or .Net code out there to do this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I managed to get my .Net LR Line Event Split tool to completely update the table view and the events on the map screen by adding a Field Calculator subroutine at the end of my code.&amp;nbsp; I just had to calculate one of the event table fields to the existing value the field already contained using &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/56414-programmatically-using-field-calculator-to-update-xy-co-ordinates-with-arcgis-10"&gt;the code provided in this post with the modifications mentioned by the user that tested it out.&lt;/A&gt;&lt;SPAN&gt;.&amp;nbsp; So at least I have had some success on a related issue that had me stuck for weeks without a solution before and that ESRI would not help me overcome.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately adding a Field Calculator process at the end of my Python code did not cause the table to update in response to the Append_management tool.&amp;nbsp; I will call it in and report it as a bug to ESRI on Monday.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Apr 2014 02:54:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/refresh-a-table-view-after-append-management/m-p/6514#M568</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2014-04-13T02:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh a Table View after Append_management</title>
      <link>https://community.esri.com/t5/python-questions/refresh-a-table-view-after-append-management/m-p/6515#M569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;One more suggestion... In your script tool, try setting up an input parameter that you set to your existing table view name.&amp;nbsp; Then for the derived output table view, set the 'Obtained From' property to the input table view parameter.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 27 Apr 2014 10:45:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/refresh-a-table-view-after-append-management/m-p/6515#M569</guid>
      <dc:creator>LT</dc:creator>
      <dc:date>2014-04-27T10:45:47Z</dc:date>
    </item>
  </channel>
</rss>

