我正在为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
。运行脚本的结果是,我正确地获得了层次结构过滤器,并且我也正确地看到了子组,但是层次结构过滤器没有分类到子组中。
[我尝试了其他一些方法:
FilterPanel.InteractiveSearchPattern = hierarchyColName
for filterHandle in filterPanel.FiltersMatchingSearchPattern:
...
->找不到任何MatchingFilters
resultDataTable.Refresh()
...
-->对结果没有影响
[能否请您帮助我将层次结构过滤器移至新创建的子组?
谢谢您!
我正在为TIBCO Spotfire处理IronPython脚本,以创建新的层次结构列,然后将与该层次结构关联的过滤器移动到TableGroup.Subgroup。在我的脚本中,我正在执行...
最后弄清楚了,如果其他人被困在同一个地方,就留下答案。