Jump to content
  • How to select all values from a given Document Property control (a List Box, in this case), using IronPython in Spotfire®


    There may be a need to select all of the values in a specific document property control when a certain condition is met (such as selection of a particular value from a drop-down list). This article contains an example IronPython script to do this.

    Introduction

    There may be a need to select all of the values in a specific document property control when a certain condition is met (such as selection of a particular value from a drop-down list). This article contains an example IronPython script to do this.

    Code sample

    # Copyright © 2017. TIBCO Software Inc.  Licensed under TIBCO BSD-style license.
    
    from System import Array
    from Spotfire.Dxp.Data import DataPropertyClass
    
    # Column using which document property is populated with
    colName = 'City'
    dc = Document.ActiveDataTableReference.Columns[colName]
    
    nodes = dc.Hierarchy.Levels.LeafLevel.TryGetNodes(int.MaxValue);
    docProperty = Document.Data.Properties.GetProperty(DataPropertyClass.Document,"docProperty1")
    strArray = Array.CreateInstance(str,nodes[1].Count)
    i = 0
    for node in nodes[1]:      
       if str(node.FormattedValue) != "None":    
        strArray[i] = node.FormattedValue    
        i=i+1
    
    #Select all     
    docProperty.Value = strArray
     

    References

    License:  TIBCO BSD-Style License

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...