Jump to content
  • How to change a calculated column expression in Spotfire® using IronPython


    The calculated column expression can be easily updated to try different expressions tied up to a property control via Spotfire Python scripting

    Introduction

    The calculated column expression can be easily updated to try different expressions tied up to a property control via Spotfire Python scripting

    Code Sample

    # Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license.
    
    mytable = Document.Data.Tables['Sales']
    mycalcol = mytable.Columns.Item['ActualSales']
    
    #For reference all properties related to a column can be retreived like this-
    ColProperties= mycalcol.Properties
    for property in ColProperties.PropertyNames:
     print property
    
    #Expression is an property of a calculated column 
    mycalcol.Properties.SetProperty('Expression','Avg([ActualSales])')
    
    #Alternatively this approach can be used to updated the calculated column expression
    mycalcCol = Document.Data.Tables["myDataTable"].Columns["mycalcCol"].As[CalculatedColumn]()
    myExpression = "[ActualSales] * [0.5]"
    mycalcCol.Expression = myExpression
     

    References

    License:  TIBCO BSD-Style License

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...