filtering - 需要 IronPython 代码在 Spotfire 中输出过滤方案

标签 filtering ironpython spotfire

我想打印仪表板每个页面特定的过滤方案的“名称”。

例如,仪表板的第 1 页可能有一个名为“过滤方案 1”的过滤方案,第 2 页可能有一个名为“过滤方案 2”的过滤方案。我有输出所有过滤方案的代码,但我无法弄清楚如何将特定方案与其所在的页面关联起来。

for pg in Document.Pages:  
  print pg.Title                # the page name  
  myPanel = pg.FilterPanel  
  print myPanel.Title           # output is the word: Filters  
  # THIS IS WHERE I WOULD WANT THE FILTERING SCHEME NAME TO APPEAR
  print myPanel.Visible         # output: True  
  print myPanel.Context         # output:  Spotfire.Dxp.Application.Filters.FilterPanel  
  print myPanel.TypeId          # TypeIdentifier:Spotfire.FilterPanel  
  print myPanel.FilteringSchemeReference  
  for i in range(myPanel.TableGroups.Count):  
    for gcObj in myPanel.TableGroups[i].FilterCollectionReference:  
      myFilter= myPanel.TableGroups[i].GetFilter(gcObj.Name)  
      if myFilter.Visible:  
         szCanSee = ' <Visible>'  
      else:  
         szCanSee = ' <Hidden>'  
      print myFilter.FilterReference.ToString() + szCanSee

最佳答案

您正在寻找 DataFilteringSelection 类,您可以在此处的 api 中找到它:http://stn.spotfire.com/dxp/html/AllMembers_T_Spotfire_Dxp_Data_DataFilteringSelection.htm

我已将您的代码精简为仅询问的部分,因为您可能需要稍微修改其余部分,因为“myPanel”将不再是 FilterPanel。

  for pg in Document.Pages:  
    print pg.Title                # the page name  
    myPanel = pg.ActiveFilteringSelectionReference
    print myPanel.Name           # output is the filter name

为了测试这一点,我创建了一个包含 4 页的文件:简介、解决方案 1、解决方案 2 和页面;以及2个过滤器:过滤方案(1)和过滤方案(2)。除了解决方案 2 使用过滤方案(2)之外,所有内容都使用过滤方案(1)。

这是我的输出:

>     Introduction
>     Filtering scheme (1)
>     Solution 1
>     Filtering scheme (1)
>     Solution 2
>     Filtering scheme (2)
>     Page
>     Filtering scheme (1)

关于filtering - 需要 IronPython 代码在 Spotfire 中输出过滤方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21633438/

相关文章:

Swift 对数组进行排序并返回索引和元素的数组

java - 在 Apache POI 中过滤

ironpython - 如何在 Spotfire IronPython 脚本中安全地使用临时文件以供 Web 使用?

opengl - 为什么 OpenGL 使用 float 来定义各向异性过滤的级别?

MySQL IMDB 过滤发布日期

python - 其余的 ironpython 异常在哪里?

python - 在 IronPython 中加载模块

python - 我们可以在 .NET ironpython 中加载 pandas DataFrame 吗?

javascript - 显示在 spotfire 可视化中标记的行的值?