Jump to content
  • How to add a calculated column and add it in Table visualization in Spotfire® using an IronPython script


    This article provides an example on how to add a calculated column in Spotfire and also add it automatically to a table visualization.

    Introduction

    This article provides an example on how to add a calculated column in Spotfire and also add it automatically to a table visualization.

    Code Sample

    # Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license.
    
    from Spotfire.Dxp.Data import CalculatedColumn
    from Spotfire.Dxp.Application.Visuals import TablePlot
    
    mycol='NewSales'
    cols = Document.Data.Tables["Data Table"].Columns
    newcol=cols.AddCalculatedColumn(mycol,"[Sales] * 2.9");
    tp = vis.As[TablePlot]()
    if newcol.Name == mycol:
     tp.TableColumns.Add(newcol)
    
    #vis a script parameter referencing the TablePlot visualization
     

    References

    License:  TIBCO BSD-Style License

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...