Is there anyway to store an expression in an IronPython script in Spotfire, and then call on it later to simplify my scripts where I am adding a bunch of calculated columns? Some of my expressions are simply (A+B), but i am also trying to see if it is possible to store an if then "case statement" as an expression
For example:
expression1 = [VarA] * 3.289
expression2 ~ (VarA] / [VarB]) * 23.33
expression3 = Case When [VarA] = 1 Then "Blue" Else "Red" End
example script (this works):
from Spotfire.Dxp.Data import CalculatedColumn
cols = Document.Data.Tables["MyTable"].Columns
cols.AddCalculatedColumn("NewColumn1","[VarA] * 3.289");
Example of what I'd like to do:
from Spotfire.Dxp.Data import CalculatedColumn
cols = Document.Data.Tables["MyTable"].Columns
cols.AddCalculatedColumn("NewColumn1","expression1");
cols.AddCalculatedColumn("NewColumn2","expression2");
cols.AddCalculatedColumn("NewColumn3","expression3");