It is possible to read and modify the checked status of values in a Check Box filter using IronPython. This allows you to script modifications to the filter settings or read the checked values for use elsewhere in the analysis file.
Introduction
It is possible to read and modify the checked status of values in a Check Box filter using IronPython. This allows you to script modifications to the filter settings or read the checked values for use elsewhere in the analysis file.
This example reads the values from a Check Box filter, toggles or modifies the status of either a specific value or all values, and outputs the checked values to an existing document property of type 'String List'.
Code sample
# 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["myFILTERINGSCHEME"] # Define column filter filt = Document.FilteringSchemes[FilterSelection][Document.Data.Tables["myDATATABLE"]]["myCOLUMN"].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['myStringListProp'] = checkedValues print checkedValues
References
License: TIBCO BSD-Style License
Back to IronPython Scripting in Spotfire Examples: https://community.spotfire.com/s/article/IronPython-Scripting-in-Spotfire
Recommended Comments
There are no comments to display.