Jump to content

Looking to set multiple values in check box filter


Prashant S A

Recommended Posts

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:
image.thumb.png.594eed485367355511cb2c3b8a9e2440.png

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

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...