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

时间:2015-11-05 20:02:20

标签: ironpython spotfire

我有一个列设置为复选框过滤器,它有两个值(“Refund”和“EMPTY”)。我想将该过滤器设置为仅选中“退款”框,但我无法找到如何设置它。

在IronPython中如何轻松完成?

2 个答案:

答案 0 :(得分:2)

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

  • 文本区域中有输入字段(colname文档属性)
  • 您可以从文本区域输入字段向过滤器传递多个值(空格分隔)。
  • 您希望从此文本字段中获取值,并将值传递给名为“Site Name”的过滤器
  • 过滤器窗格中的过滤器是ListBoxFilter

enter image description here

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
相关问题