NamesDefaultToHere(1);
// Make a table . . .
dt = NewTable("ETEST",
NewColumn("ID_1", Numeric, Continuous, Formula(RandomNormal())),
NewColumn("ID_2", Numeric, Continuous, Formula(RandomNormal())),
NewColumn("Not Required", Numeric, Continuous, Formula(RandomNormal())),
NewColumn("IG_1", Numeric, Continuous, Formula(RandomNormal())),
NewColumn("IG_2", Numeric, Continuous, Formula(RandomNormal())),
AddRows(10)
);
// Add new formula columns as required . . .
cols = dt << GetColumnNames("String");
Wait(3);
For(c=1, c<=NItems(cols), c++,
If(StartsWith(cols[c], "ID") | StartsWith(cols[c], "IG"),
// Template expression for adding the new column by a formula
CMD = Expr( dt << NewColumn("ABS("||cols[c]||")", Numeric, Continuous, Formula(Abs(colTBD))) );
// Update the expression with values for this iteration . . .
SubstituteInto(CMD, Expr(colTBD), AsName(cols[c]));
// Add the required column
CMD;
);
);