This articles explains how to set ListBoxFilter only when the values exist in Spotfire® Using IronPython Scripting
Introduction
This article provides a sample IronPython script to search if a value exists and only then apply
Code Sample
# Copyright © 2019. TIBCO Software Inc. Licensed under TIBCO BSD-style license. from Spotfire.Dxp.Application import Filters as filters myPanel = Document.ActivePageReference.FilterPanel myFilter = myPanel.TableGroups[0].GetFilter("Store Location") listboxFilter = myFilter.FilterReference.As[filters.ListBoxFilter]() #set the values to apply values="Boston,Seattle,New York" try: userInput=values.split(",") print userInput except: print "failed" #create a list for setting listbox filter setSelection=set() #get the column reference to search for columnRef=listboxFilter.DataColumnReference columnValuesCollection=columnRef.RowValues.GetEnumerator() #read the column values and check if they are in userinput for columnValue in columnValuesCollection: if columnValue.ValidValue in userInput: # if valid exists then add it to the filtering list setSelection.add(columnValue.ValidValue) #set ListBoxFilter with the values listboxFilter.IncludeAllValues=False listboxFilter.SetSelection(setSelection)
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.