Script to iterate over all columns

Hi,

I am trying to write a script to iterate over all the columns in a data table.

from Spotfire.Dxp.Data import *

dataTable = Document.Data.Tables["Test"]

print dataTable.Name

cursor = DataValueCursor.CreateFormatted(dataTable.Columns["ColumnA"])

valList = List [str]();

#iterate through table column rows to retrieve the values

for row in dataTable.GetRows(cursor):

      value = cursor.CurrentValue

      if value <> str.Empty:

        valList.Add(value)

Using above code, it means I have to create a cursor object for each column and create for loop for each cursor object

Is there a better way to loop through all columns and do necessary operations??

Thanks for help.        

 

(1) Answer

Login