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

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