ecarson

Add a table to TOC through script (10.0)

Discussion created by ecarson on Feb 11, 2014
Latest reply on Feb 12, 2014 by johnmdye
Hi,

I'm trying to add a table to the table of contents from a arcpy script.

It works fine through the command dialog but when using the commands within a script nothing seems to happen.

The command "arcpy.MakeTableView_management(...)" works fine in the command line.

I can add a layer through the script using lines, but there's no option to add a table the same way.

import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
theShape = r"C:\Test.gdb\Test_FC"
newlayer = arcpy.mapping.Layer(theShape)
arcpy.mapping.AddLayer(df, newlayer, "BOTTOM")
del mxd, df, newlayer

Any ideas or adive would be greatly appreciated.

Regards,
Elliott

Outcomes