AnsweredAssumed Answered

arcpy.ma addTable method of Map class doesn't work for .dbf table

Question asked by schurchill on Dec 11, 2018
Latest reply on Dec 12, 2018 by Dan_Patterson

ArcGIS Pro 2.2

Python 3.6

I am trying to add a .dbf table from disk to an existing map in an ArcGIS Pro project. The addTable method of the Map class works with a file geodatabase table, but does not work with a .dbf table. I created a simple map and script tool to test this, and a python script tool with a single input parameter of type "Table"

Here is the python script:

 

#script tool for testing addTable
theTable = arcpy.GetParameterAsText(0)

theProject = arcpy.mp.ArcGISProject("CURRENT")

arcpy.AddMessage(theTable)
theMap = theProject.listMaps()[0]    

#now add table to map - use table function of mp to create a table object
# then use addTable method of map to add the table
theSumTab = arcpy.mp.Table(theTable)
theMap.addTable(theSumTab)

 

When I test this script tool by navigating to a file geodatabase table everything works:

 

When I test this script tool by navigating to a .dbf table it fails:

 

Do I need to do something differently in order for this to work with a .dbf table? Or does addTable just not have that functionality. It doesn't specify that in the help: http://pro.arcgis.com/en/pro-app/arcpy/mapping/map-class.htm 

 

Thanks for any input.

 

Sheila Churchill

Outcomes