Data table row values
/Description: Get row values from two columns in a data table.
Assumptions: An optional 'myTable' data table type script parameter.
from Spotfire.Dxp.Data import DataValueCursor, IndexSet #Pick one of the following data table reference methods: #myTable = Application.Document.Data.Tables['MyDataTable'] #Name method #myTable = Application.Document.ActiveDataTableReference #Active data table method #myTable = Application.Document.Data.Tables.DefaultTableReference #Default data table method #myTable as a data table type script parameter #Script parameter method rowCount = myTable.RowCount #Get a count of existing rows rowsToInclude = IndexSet(rowCount,True) #Include all existing rows cursorDate = DataValueCursor.CreateFormatted(myTable.Columns["Date"]) #Prep to extract Date column cursorValue = DataValueCursor.CreateFormatted(myTable.Columns["Value"]) #Prep to extract Value column for row in myTable.GetRows(rowsToInclude,cursorDate,cursorValue): #Loop through all existing rows myDate = cursorDate.CurrentValue #Get Date myValue = cursorValue.CurrentValue #Get Value print myDate, myValue