ArcMap 10.3
# find (all) joins in MXD by removing them!
# usage: copy MXD and run script or run script and don't save MXD as all JOINS will be removed
# result will be a list of all layers where JOIN has been removed succesfully
import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
layers = arcpy.mapping.ListLayers(mxd)
allJoins = ''
for layer in layers:
try:
arcpy.RemoveJoin_management (layer.name)
print("join removed: "+layer.name)
allJoins += '\n'+layer.name
# no join throws exception
except Exception as err:
print(err.args[0])
print(allJoins)
No comments:
Post a Comment