Customer Banners (Ads) - SpiceUp. AX and SpotfireX Disclaimer



If you find this site useful and you want to support, buy me a coffee   to keep this site alive and without ads.

Find Data Table Dependencies in Document Visualizations

#Shows what DataTables are being used by which visualization except those used in calculated values on text areas.
#This scirpt does not detect what datatables rely on tables from current analysis

from Spotfire.Dxp.Application.Visuals import VisualContent, VisualTypeIdentifiers

tables={}
for t in Document.Data.Tables:
   tables[t.Name]=False

locations = ""

for page in Document.Pages:
 for visual in page.Visuals:
if visual.TypeId != VisualTypeIdentifiers.HtmlTextArea:
vis = visual.As[VisualContent]()
dtrtype = str(type(vis.Data.DataTableReference)) if(dtrtype)<>"<type 'NoneType'>": aTable = vis.Data.DataTableReference.Name aLocation = " -> ".join([aTable,page.Title,visual.Title]) tables[aTable]=True locations += "\n\t" + aLocation


print "Tables not being used:"
for t in sorted(tables):
if not tables[t]:print "\t",t

print "\nTables being used:"
for t in sorted(tables):
if tables[t]:print "\t",t


print "\nTables in used by:"
print locations

No comments: