Reputation: 30815
I've got a working IronPython script for loading an Excel file and adding its contents to an existing data source. When loading the Excel file, I'm using a DataFlowBuilder with an ExpressionTransformation to perform some data conversions, e.g. converting columns from Int to Real.
This works unless the column name contains square brackets - whenever I try to use a name containing square brackets, I get a "System.ArgumentException: Not a valid expression: Cast([Process Time [h]] as Real)" exception (where "Process Time [h]" (without the quotes) is the name of the Excel column).
CODE
transformation = ExpressionTransformation()
transformation.ColumnReplacements.Add(
"Process Time [h]",
"Cast([Process Time [h]] as Real)",
ColumnSelection([DataColumnSignature("Process Time [h]", DataType.Integer)])
)
Things I've tried
"Cast([\"Process Time [h]\"] as Real)"
"Cast(['Process Time [h]'] as Real)"
\
"Cast([Process Time \[h\]] as Real)"
\\
"Cast([Process Time \\[h\\]] as Real)"
Any ideas? Or should I contact Tibco Spotfire support regarding this?
Upvotes: 1
Views: 620
Reputation: 248
Cast([Process Time [h]]] as Real)
should work. Note the unbalanced number of [
and ]
.
Upvotes: 3