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

Last updated:
12:06am May 10, 2017
Back to main IronPython scripting page


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    

#Select all     
docProperty.Value = strArray




License:  TIBCO BSD-Style License