Reset All Visible Filters


from Spotfire.Dxp.Application.Filters import FilteringSchemeCollection

#Get a list of tables from the active page
tg = Document.ActivePageReference.FilterPanel.TableGroups


#Show available filters
print "Available filters:"
for t in tg:
 print t
print "------------\n"

#See if a filter is available on the filter panel
print "Visibility of filters in a table group"
for h in tg[0].FilterHandles:
 print h.FilterReference.Name, h.Visible
print "------------\n"

#Reset all available filters
print "Print all available filters and reset only the visible ones"
for t in tg:
 for h in t.FilterHandles:
   f = h.FilterReference

   #print available filters (and visibility status)
   print '[',t,'].[',f.Name,'].Visible = ',h.Visible

   #reset the filter only if it's visible
   if (h.Visible): f.Reset()

Previous
Next Post »