Jump to content

Ironpython script to filter unrelated tables


K Rojas

Recommended Posts

I have two tables in the analysis. I am using the script below to be able to filter table A and pass those filter selections to the matching filter in table B. Table A and B are visualized in a bar chart. I am triggering the code when the value of a document property changes, following instructions here:https://support.tibco.com/s/article/Tibco-KnowledgeArticle-Article-45663

I am running into two problems.

1) After the script runs, clicking Reset All Filters results in only table A being displayed in the visualization. Clicking Reset All Filters again fixes the issue.

2)When I add a second filter (commented out in the code below), making a selection in the Type_A or or Type_B filter wipes out the type B data from the visualization. I think the problem is in how IncludeAllValues is being handled, but I don't know how to fix it. Any help will be appreciated.

 

from Spotfire.Dxp.Application.Filters import *

from Spotfire.Dxp.Application.Visuals import VisualContent

from System import Guid

 

#Get the active page and filterPanel

page = Application.Document.ActivePageReference

filterPanel = page.FilterPanel

 

theFilterA = filterPanel.TableGroups[0].GetFilter("Type_A")

lbFilterA = theFilterA.FilterReference.As[ListBoxFilter]()

 

theFilter2A = filterPanel.TableGroups[1].GetFilter("Type_A")

lb2FilterA = theFilter2A.FilterReference.As[ListBoxFilter]()

lb2FilterA.IncludeAllValues = False

lb2FilterA.SetSelection(lbFilterA.SelectedValues)

 

 

#########################Type_B###########################

# theFilterB = filterPanel.TableGroups[0].GetFilter("Type_B")

# lbFilterB = theFilterB.FilterReference.As[ListBoxFilter]()

 

# theFilter2B = filterPanel.TableGroups[1].GetFilter("Type_B")

# lb2FilterB = theFilter2B.FilterReference.As[ListBoxFilter]()

# lb2FilterB.IncludeAllValues = False

# lb2FilterB.SetSelection(lbFilterB.SelectedValues)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...