AnsweredAssumed Answered

ArcPy Refreshing Table Graphic Element Source

Question asked by disch041 on Nov 9, 2018

Hello,

 

I have a template mxd containing a sample table that has a graphic element associated. I am trying to change the data source of the table, refresh the graphic element table and save a copy to new mxd. The following code works as expected from Python window in the mxd. From a python script the same code ("CURRENT" is swapped out with link to mxd) results with an mxd with correct replaced data source but the graphic element table contains no data or lines. The graphic element is still there. It also results in random green lines on the layout view. Using ArcMap 10.5.1.

 

import arcpy

templateMXD = 'c:/test/Letter_Landscape.mxd'

mxd = arcpy.mapping.MapDocument(templateMXD)

practiceTable = arcpy.mapping.ListTableViews(mxd,'practiceTable')[0]

workspace = 'c:/test/test.gdb'

practiceTable.replaceDataSource(workspace,"FILEGDB_WORKSPACE",'practiceTable')

mxd.saveACopy('c:/test/test_result.mxd')

del mxd

 

 GraphicElement  arcpy;

Outcomes