How to select the first available value in drop down instead of a dash, using IronPython in TIBCO Spotfire® (for REALs)

I found this script and it works well, but I need to use it for a REAL instead of a string

# Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license.

from System import Array

from Spotfire.Dxp.Data import IndexSet

from Spotfire.Dxp.Data import DataValueCursor

# Get table

tbl= Document.Data.Tables["Users"]

# Get access to the Column populating the choice values

# of the drop-down list control

choicesCol = tbl.Columns["AccountTypeCode"]

rowCount = tbl.RowCount

rowsToInclude = IndexSet(rowCount,True)

# Create a cursor to the Column we wish to get the values from

cursor1 = DataValueCursor.CreateFormatted(choicesCol)

# Create Array object that will hold values

strArray = Array.CreateInstance(str,rowCount)

# Loop through all rows, retrieve value for specific column,

# and add value into array

for row in tbl.GetRows(rowsToInclude,cursor1):

  rowIndex = row.Index

  value1 = cursor1.CurrentValue

  strArray[rowIndex-1] = value1

# Get only unique Values, cast to a list

uniqueVal = list(set(strArray))

# Order list

uniqueVal.sort()

# Set document property to first value found in the list

Document.Properties["AccountType"] = uniqueVal[0]

How do I adjust it to use a REAL instead of STRING?

(1) Answer

Login