我对 Iron Phyton 非常非常陌生,我正在尝试创建一个脚本,允许用户在下拉列表中选择“全部”功能。这是我到目前为止的代码,但我收到一条错误消息,指出“属性值的类型 'System.String[]' 与预期的 'System.String' 类型不匹配”
我在 Spotfire 中编码,我不能将数组存储在属性中,因为只允许使用字符串。我已经搜索过我可以使用 ', '.join(mylist)
但我只是不知道把它放在哪里......请帮忙,谢谢..代码如下
from System import Array
from Spotfire.Dxp.Data import IndexSet
from Spotfire.Dxp.Data import DataValueCursor
#Get access to the Column from which we want to get the values from
myCol = Document.ActiveDataTableReference.Columns["Business Group"]
rowCount = Document.ActiveDataTableReference.RowCount
rowsToInclude = IndexSet(rowCount,True)
#Create a cursor to the Column we wish to get the values from
cursor1 = DataValueCursor.CreateFormatted(Document.ActiveDataTableReference.Columns ["BusinessGroup"])
strArray = Array.CreateInstance(str,rowCount)
#Loop through all rows, retrieve value for specific column, and add value into array
for row in Document.ActiveDataTableReference.GetRows(rowsToInclude,cursor1):
rowIndex = row.Index
value1 = cursor1.CurrentValue
strArray[rowIndex-1] = value1
#Set property to array created above
myCol.Properties.SetProperty("BusinessGroup",strArray)