Jump to content
  • How to Update the Cell Values of a Cross Table Dynamically based on the value selected from a Property Control in Spotfire® using IronPython Scripting


    This article describes about how to dynamically update the cell values of a "Cross Table" on the value selected from a property control using IronPython.

    Introduction

    Introduction:

    This article describes about how to dynamically update the cell values of a "Cross Table" on the value selected from a property control using IronPython.

    1) Create a Property Control e.g : "List Box"

    2) Write an IronPython Script to bind the script to the Property Control so on change in the value of the Property Control, the script will be triggered.  

     

    Code Sample

    # Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license.
    
    
    # Sample IronPython script to set the cell values dynamically based on the 
    # change in the Document Property.
    
    from Spotfire.Dxp.Application.Visuals import *
    from Spotfire.Dxp.Data import *
    
    myVis = myVis.As[CrossTablePlot]()
    
    myVis.ColumnAxis.Expression = "<[Axis.Default.Names]>"
    
    myVis.RowAxis.Expression = "<[Service Line] NEST [Physician]>"
    
    #-----------------------------------------------------------
    
    # Use the below script if the Property Control is a "List Box"
    
    for DocProp in Document.Data.Properties.GetProperties(DataPropertyClass.Document):
            if DocProp.Name == "test":
                
                myVis.MeasureAxis.Expression = DocProp.Value
    
    #-----------------------------------------------------------
    
    # Use the below script if the Property Control is a "Multi select List Box"
    
    for DocProp in Document.Data.Properties.GetProperties(DataPropertyClass.Document):
            if DocProp.Name == "test":
                sel = DocProp.Value
                string = " , ".join(sel)
                myVis.MeasureAxis.Expression = string
     

    References

    License:  TIBCO BSD-Style License

    Back to IronPython Scripting in TIBCO Spotfire Examples:  https://community.spotfire.com/s/article/IronPython-Scripting-in-Spotfire

     

    dynamiccrosstable_0 (1).dxp

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...