Prashant S A Posted October 10 Share Posted October 10 Hi, I am looking for a similar script for checkbox filter where I can set not just one but multiple values. Any help would be appreciated. Link to comment Share on other sites More sharing options...
David Boot-Olazabal Posted October 11 Share Posted October 11 Hi Prashant, You may want to have a look at this article: I have created a script based on that, which works for me: # Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license. from Spotfire.Dxp.Application import Filters as filters # Define filtering scheme FilterSelection = Document.Data.Filterings["Filtering scheme"] # Define column filter filt = Document.FilteringSchemes[FilterSelection][Document.Data.Tables["NLWindData_Aggregated"]]["Province"].As[filters.CheckBoxFilter]() # Create list to store values checkedValues = [] # Loop selected values for value in filt.Values: # Toggle values using IsChecked(), Check(), Uncheck() #if value == 'my Data Value': # if filt.IsChecked(value) == True: # filt.Uncheck(value) # else: # filt.Check(value) # Store checked values if filt.IsChecked(value) == True: checkedValues.append(value) # Output checked values to existing document property of type 'String List' named 'myStringListProp' #Document.Properties['myStringList'] = checkedValues print checkedValues Document.Properties['myStringList'] = checkedValues Here is the screenshot from my analysis file, which shows you the selected values in the Checkbox filter and then have it applied to the Stringlist: If you want to preset values in the script, you have to uncheck the middle part (looping through the values) and set it accordingly. Kind regards, David Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now