Introduction
This issue occurs when custom expressions are provided as arguments to Iron Python scripts, that is, adding an input parameter representing a custom expression from a data table and/or assigning it to a document property. To workaround this issue, it is recommended to calculate the desired value directly in the script code. The example below shows how to calculate the maximum value for a table column of data type Currency.
Code sample
# Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license. from System import Decimal from Spotfire.Dxp.Data import * maxcol1 = 0 maxcol2 = 0 table = Document.Data.Tables['tableName'] acursor = DataValueCursor.CreateFormatted(table.Columns["currencyColumn1"]) bcursor = DataValueCursor.CreateFormatted(table.Columns["currencyColumn2"]) # Calculate MAX column values for row in table.GetRows(acursor, bcursor): if acursor.CurrentValue > maxcol1: maxcol1 = acursor.CurrentValue if bcursor.CurrentValue > maxcol2: maxcol2 = bcursor.CurrentValue (bool1, variableName1)=Decimal.TryParse(maxcol1) #print bool1 (bool2, variableName2) = Decimal.TryParse(maxcol2) #print bool2 ######################################################################################### # For table column of data type String, you could use the sample below as a workaround. ######################################################################################## from Spotfire.Dxp.Data import DataValueCursor lst = [] table = Document.Data.Tables['tableName'] cursor = DataValueCursor.CreateFormatted(table.Columns["StringColumnName"]) # Calculate MAX column values for row in table.GetRows(cursor): lst.Add(cursor.CurrentValue) #print lst max_str = max( i for i in lst if isinstance(i, str) ) #print max_str Document.Properties["propertyName"] = max_str
Note: This issue has been addressed in TIBCO Spotfire version 7.6.
References
License: TIBCO BSD-Style License
Recommended Comments
There are no comments to display.