NightLearner
NightLearner

Reputation: 305

How to add calculated columns and perform Calculations with IronPython Script in Spotfire

I am using this script (below) to create a calculate column [NEWCOLUMN] in Spotfire using IronPython:

from Spotfire.Dxp.Data import CalculatedColumn

cols = Document.Data.Tables["TIBER"].Columns

cols.AddCalculatedColumn("NEWCOLUMN");

How do I control the datatype of the calculated column? Also, then what is the processes to edit the expression of the calculated column? For example, I would like NEWCOLUMN = [oldcolumn]*3.289

Thanks!

Upvotes: 2

Views: 3467

Answers (1)

S3S
S3S

Reputation: 25142

Your calculated column will inherit the data type from the expression in <arg2> of AddCalculatedColumn(<arg1>,<arg2>).

i.e.

from Spotfire.Dxp.Data import CalculatedColumn
cols = Document.Data.Tables["TIBER"].Columns
cols.AddCalculatedColumn("NEWCOLUMN","[oldcolumn] * 3.289");

Roll Tide.

Upvotes: 2

Related Questions