AnsweredAssumed Answered

Adding table to Table of Contents

Question asked by tdbeezy on Aug 5, 2013
Latest reply on Aug 6, 2013 by tdbeezy
I am using Arc 10.1. I am trying to add a table to the Table Of Contents using the following script but it doesn't show up without saving to a new map mxd document. I am using the following code:

                mxd = arcpy.mapping.MapDocument('CURRENT')
                df = arcpy.mapping.ListDataFrames(mxd, "layers")[0]
                accidentsTable = arcpy.mapping.TableView("H:/ss/Projects/MaPP/Habitat.gdb/tablename")
                arcpy.mapping.AddTableView(df, accidentsTable)

This seems to run fine but it's not showing up in the Table of Contents. I've tried using following:

but it still doesn't show up. If I save the mxd file under a different name and reload the file using


the table is in the Table of Contents, but that kind of defeats the purpose.

It seems like I'm missing something simple. Does anybody have any ideas on how I can add a newly created data table to the active data frame and have it show up in the currently open map document.
Much thanks for any help on this.