Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am running the Calculate Field GP tool from the arcpy in ArcMap. When a row value is updated, it does not show up untill I use the Reload Cache tool (Table Options > Reload Cache). How do I refresh the attribute table automatically without using ArcObjects?

I have tried updating the definition query as @blah238 suggested Using python, how do you "reload cache" an opened Attribute Table, but this doesn't help. Resetting the data source is not an option because the feature class might be in the editing session and I don't want to lose the connection to the source data.

share|improve this question
    
Are you using ArcGIS 10.1? If so are you using a Python Add-in or a Python script tool to run Calculate Field? –  PolyGeo May 7 '13 at 7:59
1  
Does it really matter? I am calling the Calculate Field GP tool from a Python Add-in, but the same thing is observed when running the GP tool from the Python window. –  Alex Tereshenkov May 7 '13 at 8:13
1  
I always figure that if I am going to try and reproduce a problem, then the most likely way I will see it is if I do exactly (or as close as I can get to) the same steps in the same configuration as it has been seen before. –  PolyGeo May 7 '13 at 9:37
add comment

2 Answers 2

up vote 2 down vote accepted

You appear to be hitting a limitation of ArcPy, in the absence of ArcObjects.

The limitations of ArcPy.mapping have been broadly described here as:

Arcpy.mapping is not a replacement for ArcObjects but rather an alternative for the different scenarios it supports. ArcObjects is still necessary for finer-grain development and application customization, whereas arcpy.mapping is intended for automating the contents of existing map documents and layer files.

If @blah238's other suggestion of using ArcObjects from ArcPy is not an option for you, then you may be best to submit an ArcGIS Idea to have this functionality exposed to ArcPy. If you post a link to such an ArcGIS Idea here then I will be happy to vote for it.

share|improve this answer
    
Thanks PolyGeo, pity we cannot find a way to refresh the attribute table when calculating field values outside the editing session. –  Alex Tereshenkov May 7 '13 at 12:45
    
You might submit an enhancement request to ESRI tech support. I requested the ability to just have a button, menu option or F key to refresh the table to show changes without manually closing and opening. I was told the table should update on its own and the matter was closed as not locally reproducible. Usually they are helpful. I got the impression they are not even aware of the limitations. –  johns May 7 '13 at 21:37
    
I recommend doing both of the above but ArcGIS Ideas lets you monitor popularity & implementation progress much more easily than local support here. –  PolyGeo May 7 '13 at 22:04
1  
@johns, do you know that you don't have to close and open the attribute table to refresh it? The current way to do this is to click Table Options button > Reload Cache. Another thing that works is to run the Calculate Field operation in the editing mode, then the values in the attribute tables are updated immediately. –  Alex Tereshenkov May 8 '13 at 9:03
    
@Alex, thanks for the suggestion; it made me go back to test the issue further. I have used the reload cache but it failed/fails when I've added polygons in edit mode in layout view using an addin to get the layout extent. When in data view and I use the same addin, then the reload cache works. So it somehow involves the layout view. –  johns May 8 '13 at 14:18
show 1 more comment

Have you tried:

arcpy.RefreshCatalog(target) # Set the target to your layers data source

or

arcpy.RefreshActiveView() # Refreshes the map

or

arcpy.RefreshTOC() # I highly doubt this will do anything, but you never know

I think one of these will work, but I know sometimes in ArcMap I have to manually close the attribute table then re-open it to see some edits. I'm not sure if closing and opening the table can be done with ArcPy, but that would also be an option.

share|improve this answer
    
Thansk, Cody, unfortunately, nothing of this works. Closing and opening the attribute table manually does the trick, however I am looking for something that would do that programmatically. Opening and closing attribute table is not available with Python either. –  Alex Tereshenkov May 6 '13 at 14:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.