Jump to content
  • IronPython script to iterate over filtered rows in Spotfire®


    Spotfire® allows the use of value cursors to iterate over data (filtered or otherwise) in a Spotfire data table.

    Introduction

    Spotfire® allows the use of value cursors to iterate over data (filtered or otherwise) in a Spotfire data table.

    Iterate over filtered rows

    he below script can be used to iterate over filtered rows 

    # Copyright © 2017. TIBCO Software Inc.  Licensed under TIBCO BSD-style license.  
     
    # Specify the data table used in Spotfire 
    dataTable = Document.Data.Tables["My Table"]  
     
    # Get a reference to the specified filtering scheme on the data table above 
    dataFilteringSelection = Document.Data.Filterings["My Filter Scheme"]	 
    filteringScheme = Document.FilteringSchemes[dataFilteringSelection] 
    filterCollection = filteringScheme[dataTable]  
     
    # Filtered rows based on the scheme above 
    filteredRows = filterCollection.FilteredRows  
     
    # Specify the column in the data table to get the values 
    myColCursor = DataValueCursor.CreateFormatted(dataTable.Columns["My Col"])
     
    # Iterate over the filtered rows 
     for row in dataTable.GetRows(filteredRows,myColCursor):   
     	# cursorValue will now contain the value for the column at the current row position   
     	cursorValue = myColCursor.CurrentValue
     
     

    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...