Jump to content
  • Code sample script that reads generic values in a table column and stores them in a List object.

    Introduction

    The following is a sample script that reads generic values in a table column and stores them in a List object:

    Code Sample

    # Copyright © 2017. TIBCO Software Inc.  Licensed under TIBCO BSD-style license.
    
    from Spotfire.Dxp.Data import *
    
    tableName='World Bank Data'
    columnToFetch='Region'
    activeTable=Document.Data.Tables[tableName]
    rowCount = activeTable.RowCount
    print rowCount
    rowsToInclude = IndexSet(rowCount,True)
    cursor1 = DataValueCursor.CreateFormatted(activeTable.Columns[columnToFetch])
    ctr1 = 0
    for row in activeTable.GetRows(rowsToInclude,cursor1):
    	rowIndex = row.Index
    	val1 = cursor1.CurrentValue
    	print val1
    	ctr1 = ctr1 + 1
    	if (ctr1 == 5):
    		break
     

    Note: If you want only the unique values from the table column, you can use the GetDistinctRows method instead of the GetRows method in the example above. 

    References

    License:   TIBCO BSD-Style License

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...