from Spotfire.Dxp.Data import DataValueCursor
from Spotfire.Dxp.Data import IndexSet
tableName = 'MyDataTable'
columnName = 'MycolumnName'
dt = Document.Data.Tables[tableName]
cursor = DataValueCursor.Create[str](dt.Columns[columnName])
distinctRows = dt.GetDistinctRows(None,cursor) #none param to grab them
#distinctRows = dt.GetDistinctRows(IndexSet(dt.RowCount,True),cursor) #...or an index set with all true to get them all.
#get uniques
vals = []
distinctRows.Reset()
while distinctRows.MoveNext():vals.append(cursor.CurrentValue)
#show results
print vals
2 comments:
Hi,
How do i use these values in the text area?
Vedanshi,
Instead of printing the output, store it in a document property:
Document.Properties["dVals"] = vals
Make sure you created a String doc prop in Spotfire called 'dVals'
In the text area use a label control to point to dVals
Post a Comment