Jump to content
We've recently updated our Privacy Statement, available here. ×
  • How to sort a column from a given data table in Spotfire® using IronPython Scripting


    How to sort a column from a given data table in TIBCO Spotfire® using IronPython Scripting

    Introduction

    This article gives a code sample to sort a column from a given data table. Refer to the attached analysis file.

    Code Sample

    # Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license.
    
    from Spotfire.Dxp.Application.Visuals import TablePlot, TablePlotColumnSortMode
    
    table = tableVis.As[TablePlot]() #refers the required table visualization 
    
    table.SortInfos.Clear() # clears all the existing sorting applied on the table
    
    table.SortInfos.Add(Document.Data.Tables["tableName"].Columns["columnName"], 
                                             TablePlotColumnSortMode.Descending)
    #sorts the desired column taken from columnName parameter
    
    #Replace the 2nd parameter to sort the column in Ascending order
    #TablePlotColumnSortMode.Ascending
     

    References

    License:  TIBCO BSD-Style License

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...