Jump to content
We've recently updated our Privacy Statement, available here. ×

how to use script for dynamic drop down filter


gurusai sankar

Recommended Posts

Hi All,

I am beginner for scripting. I have a column called "BASELINE_NAME " and fixed drop down filter in text area. my requirement is- Based on Baseline drop down- capital cost and expenditure cost per year which i am showing in the bar chart should change dynamically and also should reflect all other filters in text area which is related to this data. BASELINE is having the data like 2018B1, 2018B2,2019B1,2019B2. and also i have used filtering schema called "page 2". I have written below script. but it is not working sometimes. Can someone please help on this, Please let me know if script is not required for this requirement.

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

#Get reference for FilteringScheme used for your filter

for fs in Document.FilteringSchemes:

print fs.FilteringSelectionReference.Name

if fs.FilteringSelectionReference.Name == "page 2":

filterPanel.FilteringSchemeReference = fs

#Let's find "Col_LBFilter" filter and read the selected Values

#This example uses a listbox filter, you may use any.

filterPanel.InteractiveSearchPattern = "BASELINE_NAME"

for filter in filterPanel.FiltersMatchingSearchPattern:

if filter.FilterReference.Name == "BASELINE_NAME":

lbFilter = filter.FilterReference.As[ListBoxFilter]()

array=Document.Properties["baselinedropdown1"]

#lbFilter.IncludeAllValues=False

#This will print selected values in List box filter

#print lbFilter.SelectedValues

#To set list box filter, Make sure that the data type of the values match the column type. In this example, "1,", "2", "5" are the actual column values to be selected in the filter.

try:

lbFilter.SetSelection(array)

except:

print "cook"

##_array = ["2018B2"]

print "ok"

Regards,

Guru

Link to comment
Share on other sites

Hmmm. Is the dataset that you are using for the report comimg from two tables. In other words, did you add column/s to the main table from anothe table If yes, then you need to check how you matched the columns from the two tables. It seems the issue has to do with Joins or Matching of the columns.
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...