Is it possible to create a new Filtering Scheme and set it to a page only using Iron Python? The reason why I am looking into that is because the Web Player currently does not allow us to create Filtering Schemes. I hope to achieve that by executing a script which will be triggered by a Document property change. The name of the filtering scheme will be passed from the JavaScript api my using SetDocumentProperty method.
The script below adds a new Filtering Scheme but I cannot select it from the Filtering Scheme menu in the Spotfire Analyst, it's nowhere to be seen. What am I missing?
from Spotfire.Dxp.Data import *
from Spotfire.Dxp.Application.Filters import *
Document.ActivePageReference.FilterPanel.Visible = True
# Add a new data filtering selection.
filterings = Document.Data.Filterings
filterings.Add("Test Filtering 1")
for f in filterings:
print f.Name
I cannot see my newly added FilteringScheme after I ran the above script from the Filtering Scheme menu on the Analyst:
The issue here is that "filterings" is a variable that you created, not an alias for the filter list -- you filled it with the data in the existing filters, but updating filterings afterwards does not update the filters on the page itself.
Change the code to this:
from Spotfire.Dxp.Data import *
from Spotfire.Dxp.Application.Filters import *
Document.ActivePageReference.FilterPanel.Visible = True
# Add a new data filtering selection.
Document.Data.Filterings.Add("Test Filtering 1")
filterings = Document.Data.Filterings
for f in filterings:
print f.Name