Warning when upgrading to Spotfire 10

TIBCO has deprecated the JQueryUI Javascript library in the latest Spotfire 10.0 release

TIBCO Community pages show us how to use JQuery properly

Filtering Schemes (current, all, add, set and other tricks)

from Spotfire.Dxp.Application.Filters import FilterPanel

#Show (or hide) the filter panel

Document.ActivePageReference.FilterPanel.Visible = True

#Get the current filtering scheme name
print Document.ActiveFilteringSelectionReference.Name

#List all the filtering schemes
for scheme in Document.FilteringSchemes: 
  print scheme.FilteringSelectionReference.Name

# Add a new data filtering selection (DataFilteringSelection)
dataFilteringSelection = Document.Data.Filterings.Add("My Filtering")

# A filtering scheme has now been implicitly added for the new data filtering selection (FilteringScheme).
myFilteringScheme = document.FilteringSchemes[dataFilteringSelection]

#Let the active page use the new filtering scheme. 
document.ActivePageReference.FilterPanel.FilteringSchemeReference = myFilteringScheme

#Make sure that the filter panel shows the filtering scheme menu. 
document.FilteringSchemes.FilteringSchemeMenuVisible = true;

#get a reference to the current filtering scheme
currentFiltering = Document.FilteringSchemes[Document.ActiveFilteringSelectionReference]

#set search expression to current filtering scheme to show only modified filters Document.ActivePageReference.FilterPanel.InteractiveSearchPattern = "status:modified"


Digvijoyee Das said...

For listing all filtering schems, on writing the syntax and running, I get below error:

AttributeError: 'FilteringScheme' object has no attribute 'Name'

My requirement is to change filter values of another filter scheme, that which is currently hidden and is also no the default one, by clicking a button and using iron python.

Jose Leviaguirre said...

Hello Digvijoyee,



Documentation here:

Digvijoyee Das said...

Hi Jose,

Thanks !!

Actually I just wanted to change filter values of a filtering scheme by changing filter values of a different filtering scheme and the different scheme I had already created.

But any how I created one solution to do this. The only thing is that I had to create a new tab and thiis didn't become an issue for me as mine is a guided analysis dashboard.

Below is my code (the filter in code is the Date filter (column name is Date):


import Spotfire.Dxp.Application.Filters as filters


for scheme in Document.FilteringSchemes:
if (i==1):
for item in Document.Pages:
if (item.Title=="Test Page DO NOT DELETE OR RENAME !!!"):

myfilter.IncludeAllValues= False

haydenridd said...

Hello! This is really old but just wanted to post a follow up for anyone else using this as a resource. The reason for the "AttributeError: 'FilteringScheme' object has no attribute 'Name'" error occurs is because a "FilteringScheme" object does not have a "Name" property. To get what you are looking for you simply need to change:
for scheme in Document.FilteringSchemes:
print scheme.Name

for scheme in Document.FilteringSchemes:
print scheme.FilteringSelectionReference.Name



Jose Leviaguirre said...

Thank you Hayden! I fixed to code with your suggestions.

Sunitha Reddy said...

Hi Digvijoyee,
I saw your post and I am actually looking for the same kind of code. I have a filtering schema. I need to capture the some of the filter values to change the cross table value axis formulas based on which filter values they have selected and apply same filtering changes to another schema. Can you please share code that applies one filtering schema changes to another filtering Schema after clicking a button. My analysis has bunch of filtering schema's but I wanted 2 of them needs to be in synch.


Ameet Patil said...

Hi All,

I wanted to get the coulmn Name of the Active filters available in the Current Page..

Jose Leviaguirre said...

Hello Ameet,

Try this code:

tableGroups = Document.ActivePageReference.FilterPanel.TableGroups
for tableGroup in tableGroups:
for filterHandle in t.FilterHandles:
filter = filterHandle.FilterReference

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

More information here: http://spotfired.blogspot.com/2014/08/reset-visible-filters.html