This is the script I was discussing in class that walks through the visualizations and finds what tables are being used:


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


tables={}

for t in Document.Data.Tables:

    tables[t.Name]=Falselocations = ""

for page in Document.Pages:

    for visual in page.Visuals:

        if visual.TypeId != VisualTypeIdentifiers.HtmlTextArea:

            vis = visual.As[VisualContent]()

            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