我有一个列设置为复选框过滤器,它有两个值(“Refund”和“EMPTY”)。我想将该过滤器设置为仅选中“退款”框,但我无法找到如何设置它。
在IronPython中如何轻松完成?
答案 0 :(得分:2)
以编程方式(从文本输入字段)设置过滤器
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()
参考: http://spotfired.blogspot.com/2014/03/change-filters-programatically-from.html
答案 1 :(得分:0)
以下是我设置复选框过滤器的方法。 TOH到@Niko和@Jacek Sierajewski为"(空)"提示cb过滤器设置!
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