IronPython Spotfire:创建层次结构列并将关联的过滤器移动到TableGroup.Subgroup

问题描述 投票:0回答:1

我正在为TIBCO Spotfire处理IronPython脚本,以创建新的层次结构列,然后将与该层次结构关联的过滤器移动到TableGroup.Subgroup。

在我的脚本中,我正在执行以下操作:1.检索表组“结果表组”2.检索数据表“结果表”3.创建一个新的子组“结果层次结构子组”4.遍历表组中的所有过滤器,然后-隐藏过滤器-为与过滤器相关的列创建层次结构列-尝试将过滤器移至子组

这里是代码中的相关部分:

filterPanel = Document.ActivePageReference.FilterPanel

# get the correct tableGroup
for tableGroup in filterPanel.TableGroups:
    if tableGroup.Name == "Result Table Group":
        resultTableGroup = tableGroup

# get the correct dataTable
for table in Document.Data.Tables:
    if table.Name == "Result Table":
        resultDataTable = table

# create new subgroup
hierarchyfilterGroup = resultTableGroup.AddNewSubGroup("Result hierarchy subgroup")

filterPanel.InteractiveSearchPattern = ""
for filterHandle in filterPanel.FiltersMatchingSearchPattern:
    tableGroupFilterHandle = resultTableGroup.GetFilter(filterHandle.FilterReference.Name)

    if tableGroupFilterHandle != None:
       tableGroupFilterHandle.Visible = False # hide filter in table group

       # create a new hiearchy column
       hierarchyColName = tableGroupFitlerHandle.FilterReference.Name + " - process hierarchy"
       hierarchyExpressions = List[str]()
       hierarchyExpressions.Add("[" + tableGroupFitlerHandle.FilterReference.Name + "]")
       hierarchyExpressions.Add("[Process]")
       hierarchy = HierarchyDefinition(HierarchyNestingMode.Nested, hierarchyExpressions)
       resultDataTable.Columns.AddHierarchyColumn(hierarchyColName, hierarchy)

       # try to get the hierarchy associated filter
       hieararchyFilterHandle = tableGroup.GetFilter(hierarchyColName)
       if hiearchyFilterHandle != None:
           hierarchyfilterGroup.Add(hierarchyFilter.FilterReference)

但是,tableGroup.GetFilter(hierarchyColName)总是为层次列返回None。运行脚本的结果是,我正确地获得了层次结构过滤器,并且我也正确地看到了子组,但是层次结构过滤器没有分类到子组中。

[我尝试了其他一些方法:

  1. 在整个FilterPanel中搜索层次过滤器
  2. FilterPanel.InteractiveSearchPattern = hierarchyColName
    for filterHandle in filterPanel.FiltersMatchingSearchPattern:
        ...
    

->找不到任何MatchingFilters

  1. 尝试查找过滤器之前刷新dataTable
  2. resultDataTable.Refresh()
    ...
    

-->对结果没有影响

  1. 在第一个循环之后使用单独的第二个循环来移动滤镜
  2. [能否请您帮助我将层次结构过滤器移至新创建的子组?

谢谢您!

我正在为TIBCO Spotfire处理IronPython脚本,以创建新的层次结构列,然后将与该层次结构关联的过滤器移动到TableGroup.Subgroup。在我的脚本中,我正在执行...

filter ironpython hierarchy spotfire
1个回答
0
投票

最后弄清楚了,如果其他人被困在同一个地方,就留下答案。

© www.soinside.com 2019 - 2024. All rights reserved.