GetDistinctRows (7.0+)

#get unique values from column (7.0)
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 by the all
#distinctRows = dt.GetDistinctRows(IndexSet(dt.RowCount,True),cursor) #...or an index set with all true to get them all.

#get uniques
vals = []
while distinctRows.MoveNext():vals.append(cursor.CurrentValue)

#show results
print vals


Vedanshi Murarka said...


How do i use these values in the text area?

Jose Leviaguirre said...


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