如何在 Spotfire 中使用 IronPython 设置复选框过滤器?

How can checkbox filter be set with IronPython in Spotfire?

我有一列设置为复选框过滤器,它有两个值("Refund" 和 "EMPTY")。我想将该过滤器设置为仅选中 "Refund" 框,但我不知道如何设置它。

如何在 IronPython 中轻松完成此操作?

以编程方式设置过滤器(从文本输入字段)

  • 您在文本区域中有一个输入字段(colname 文档 属性)
  • 您可以将多个值(space 分开)从文本区域输入字段传递给过滤器。
  • 您想从此文本字段中获取值并将该值传递给名为 'Site Name'
  • 的筛选器
  • 过滤器面板中的过滤器是一个 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()

参考: http://spotfired.blogspot.com/2014/03/change-filters-programatically-from.html

这是我设置复选框过滤器的方法。 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