Set Filters Programatically (from a text input field)

* You have an input field in a text area (colname document property)
* You can pass multiple values (space separated) to the filter from the text area input field.
* You want to take the value from this text field and pass the value to a filter named 'Site Name' 
* The filter in the filter palnel is a ListBoxFilter 













import Spotfire.Dxp.Application.Filters as filters
import Spotfire.Dxp.Application.Filters.ListBoxFilter
from Spotfire.Dxp.Application.Filters import FilterTypeIdentifiers
from Spotfire.Dxp.Data import DataPropertyClass
from System import String
myPanel = Document.ActivePageReference.FilterPanel
myFilter= myPanel.TableGroups[0].GetFilter("Site Name")
lbFilter = myFilter.FilterReference.As[filters.ListBoxFilter]()
lbFilter.IncludeAllValues=False
strVals = Document.Properties["colname"]
if strVals!=String.Empty:
  lbFilter.SetSelection(strVals.split())
else:
  lbFilter.Reset()



Previous
Next Post »