I want to print the "name" of the filtering scheme that is specific for each page of my dashboard.
For instance, page 1 of the dashboard may have a filtering scheme named "Filter Scheme 1" and page 2 has "Filter Scheme 2". I have code that outputs ALL of the Filtering Schemes but I cannot figure out how to associate a specific scheme to the page it sits on.
for pg in Document.Pages:
print pg.Title # the page name
myPanel = pg.FilterPanel
print myPanel.Title # output is the word: Filters
# THIS IS WHERE I WOULD WANT THE FILTERING SCHEME NAME TO APPEAR
print myPanel.Visible # output: True
print myPanel.Context # output: Spotfire.Dxp.Application.Filters.FilterPanel
print myPanel.TypeId # TypeIdentifier:Spotfire.FilterPanel
print myPanel.FilteringSchemeReference
for i in range(myPanel.TableGroups.Count):
for gcObj in myPanel.TableGroups[i].FilterCollectionReference:
myFilter= myPanel.TableGroups[i].GetFilter(gcObj.Name)
if myFilter.Visible:
szCanSee = ' <Visible>'
else:
szCanSee = ' <Hidden>'
print myFilter.FilterReference.ToString() + szCanSee
You are looking for the DataFilteringSelection class which you can find in the api here: http://stn.spotfire.com/dxp/html/AllMembers_T_Spotfire_Dxp_Data_DataFilteringSelection.htm
I've trimmed down your code to just the section asked about as you may need to revise the rest a little as 'myPanel' will no longer be a FilterPanel.
for pg in Document.Pages:
print pg.Title # the page name
myPanel = pg.ActiveFilteringSelectionReference
print myPanel.Name # output is the filter name
To test this I created a file with 4 pages: Introduction, Solution 1, Solution 2 and Page; and 2 filters: Filtering scheme (1) and Filtering scheme (2). Everything used Filtering scheme (1) except Solution 2 which used Filtering scheme (2).
Here is my output:
> Introduction
> Filtering scheme (1)
> Solution 1
> Filtering scheme (1)
> Solution 2
> Filtering scheme (2)
> Page
> Filtering scheme (1)