How do I insert a reference to a dynamically generated table variable name inside a column formula such that I can later change the table variable and still have the column values update. And then do this for a unknown number of columns.
dt = Current Data Table();
NewCol = function({ColNr},
//Set a name table variable with the name of the column and RMSE appended to it
dt << Set Table Variable( concat(Column(ColNr)<< Get Name(),"RMSE"), 0 );
//Create a new column with the same name as the original column but with " with RMSE" at the end.
//Place a formula in this column which takes the original column value and add random RMSE as specified by the table variable to it.
Eval(
substitute(
expr(
dt<<New Column(Concat(__ResponseCol__<< Get Name()," with RMSE"),Numeric,
"Nominal",
Format( "Best", 12 ),
Formula(__ResponseCol__ + Random Normal(0,__RMSE__)),
)
),
Expr(__ResponseCol__),Column(ColNr),
Expr(__RMSE__),/*How to create a reference to the table variable here*/,
)
)
);
//Should later iterate from 7 to 9 and scale with the numer of response columns in the data table.
//Hardcoded to 7 for this example.
NewCol(7);