Solved! Go to Solution.
Thank you eibenm,
In fact, I am not intend to do after the attribute table is opened.
As user's request, I create a new arctoolbox with several script tools using python. After entering the searching criteria, a table with the selected features data need to displayed on the map in a table format. I am not sure whether I should try to open the attribute table or I should create a table on this. Any body have experience on this?
thanks
import arcpy mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd") df = arcpy.mapping.ListDataFrames(mxd, "Transportation")[0] accidentsTable = arcpy.mapping.TableView(r"C:\Project\Data\Transportation.gdb\Accidents") arcpy.mapping.AddTableView(df, accidentsTable) mxd.saveACopy(r"C:\Project\Project2.mxd") del mxd, accidentsTable
fields = ["ID","Name","Address","City","Zip","Distance"] query = "\"Distance\" > 3" with arcpy.da.SearchCursor("FeatureLayer", fields, query) as cursor: for row in cursor: print row
Thank you eibenm,
In fact, I am not intend to do after the attribute table is opened.
As user's request, I create a new arctoolbox with several script tools using python. After entering the searching criteria, a table with the selected features data need to displayed on the map in a table format. I am not sure whether I should try to open the attribute table or I should create a table on this. Any body have experience on this?
thanks
import arcpy mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd") df = arcpy.mapping.ListDataFrames(mxd, "Transportation")[0] accidentsTable = arcpy.mapping.TableView(r"C:\Project\Data\Transportation.gdb\Accidents") arcpy.mapping.AddTableView(df, accidentsTable) mxd.saveACopy(r"C:\Project\Project2.mxd") del mxd, accidentsTable