Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Add a table to TOC through script (10.0)

$
0
0
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

Viewing all articles
Browse latest Browse all 2485

Trending Articles