I have a column that is set as a checkbox filter which has two values ("Refund" and "EMPTY"). I'd like to set that filter to have only the "Refund" box checked, but I can't find out how to set it.
How is this done easily in IronPython?
I have a column that is set as a checkbox filter which has two values ("Refund" and "EMPTY"). I'd like to set that filter to have only the "Refund" box checked, but I can't find out how to set it.
How is this done easily in IronPython?
Set Filters Programatically (from a text input field)
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()
Reference: http://spotfired.blogspot.com/2014/03/change-filters-programatically-from.html
Here's how I'm setting the checkbox filters. TOH to @Niko and @Jacek Sierajewski for the "(Empty)" hint for cb filter settings!
from Spotfire.Dxp.Application import Filters as filters
strTtype= Document.Properties['Ttype']
FilterSelection = Document.Data.Filterings["Main Scheme"]
cbfRefund = Document.FilteringSchemes[FilterSelection][Document.Data.Tables["Transaction Data"]]["Refund Transaction"].As[filters.CheckBoxFilter]()
if strTtype=="Refund":
for CheckBoxValue in cbfRefund.Values:
cbfRefund.Uncheck(CheckBoxValue)
if CheckBoxValue == "Refund":
cbfRefund.Check(CheckBoxValue)
cbfRefund.IncludeEmpty=False#This clears the "(Empty)" checkbox