Spotfire-通过IronPython根据文档属性值标记表中的行

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

我想基于文档值的值标记行。例如,我将具有一个文档属性KeySet = K2。当我运行IronPython脚本时,应标记T2,K2、2.00行。

我正在尝试遵循

https://community.tibco.com/wiki/how-mark-visualization-based-unmarked-rows-another-visualization-tibco-spotfirer-using

https://community.tibco.com/wiki/how-mark-all-filtered-rows-table-using-ironpython-tibco-spotfirer

但是我对IronPython不太熟悉,所以我不完全知道如何将它们组合成自己想要的样子。

这可能吗?谢谢。

初始状态:

enter image description here

运行脚本后,标记了T2。

enter image description here

ironpython spotfire
1个回答
0
投票

以下是基于文档属性选择来标记行的示例脚本参考

from Spotfire.Dxp.Data import *

selectedValue=Document.Properties["propertyName"]
#Create a cursor to refer a column which will have the values
table=Document.Data.Tables["tableName"]
cursor = DataValueCursor.CreateFormatted(table.Columns["columnName"])

rowCount = table.RowCount
#empty indexset
rowsToMark = IndexSet(rowCount,False)
for row in Document.ActiveDataTableReference.GetRows(cursor):
   rowIndex = row.Index
   if cursor.CurrentValue == selectedValue:
       rowsToMark.AddIndex(rowIndex)

Document.ActiveMarkingSelectionReference.SetSelection(RowSelection(rowsToMark),table)
© www.soinside.com 2019 - 2024. All rights reserved.