4

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

例如,仪表板的第 1 页可能有一个名为“Filter Scheme 1”的过滤方案,而第 2 页有“Filter Scheme 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
4

1 回答 1

3

您正在寻找可以在 api 中找到的 DataFilteringSelection 类: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)
于 2014-03-19T15:53:15.930 回答