Advertisement
zAzez

Spotfire Filter

Dec 11th, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. from Spotfire.Dxp.Application.Filters import *
  2.  
  3. from Spotfire.Dxp.Application.Visuals import VisualContent
  4. from System import Guid
  5.  
  6. selectedColor = Document.Properties["LineFilter"]
  7.  
  8. #Get the active page and filterPanel
  9. page = Application.Document.ActivePageReference
  10. filterPanel = page.FilterPanel
  11.  
  12. #Get reference for FilteringScheme used for your filter
  13. for fs in Document.FilteringSchemes:
  14. if fs.FilteringSelectionReference.Name == "Filtering scheme":
  15. filterPanel.FilteringSchemeReference = fs
  16.  
  17. #This example uses a listbox filter, you may use any.
  18. filterPanel.InteractiveSearchPattern = "Line"
  19. for filter in filterPanel.FiltersMatchingSearchPattern:
  20. if filter.FilterReference.Name == "Line":
  21. lbFilter = filter.FilterReference.As[ListBoxFilter]()
  22. #This will print selected values in List box filter
  23. #print lbFilter.SelectedValues
  24. #To set list box filter, Make sure that the data type of the values match the column type. In this example, "1,", "2", "5" are the actual column values to be selected in the filter.
  25. _array = []
  26. _array.append(selectedColor)
  27.  
  28. if selectedColor is None :
  29. lbFilter.IncludeAllValues=True
  30.  
  31.  
  32. else :
  33. lbFilter.IncludeAllValues=False
  34. lbFilter.SetSelection(_array)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement