Good post regarding this topic is Insert one expression into another using Eval Insert, Eval Expr, Parse, and Substitute . In your case you do need a bit more complicated solution as you are using column indices instead of column names if you want to have formulas (most of the time I would suggest using names instead of indices). Most of the time I use Eval(EvalInsert()) but substitute is also good option
Names Default To Here(1);
dt = New Table("Untitled",
Add Rows(3),
Compress File When Saved(1),
New Column("Column 1", Numeric, "Continuous", Format("Best", 12), Set Values([1, 2, 3])),
New Column("Column 2", Numeric, "Continuous", Format("Best", 12), Set Values([2, 3, 4])),
New Column("Column 3", Numeric, "Continuous", Format("Best", 12), Set Values([3, 4, 5])),
New Column("Column 4", Numeric, "Continuous", Format("Best", 12), Set Values([4, 5, 6])),
New Column("Column 5", Numeric, "Continuous", Format("Best", 12), Set Values([6, 7, 8]))
);
For(j = 1, j < 5, j = j + 2,
// ColLen = Length(Char(Column Name(j)));
// ColName = Left(Char(Column Name(j)), ColLen - 6);
// NewCol = Substr(ColName, 6);
new_col = Word(2, Column(dt, j) << get name, " ");
Eval(Eval Expr(
New Column("Delta: " || new_col, Numeric, Formula(
Expr(NameExpr(AsColumn(j))) - Expr(NameExpr(AsColumn(j + 1)))
))
));
);
Some additional functions/messages that might be of interest to you: << Get Column Names, Word() (search also for Words(), Item() and Items() from scripting index), For Each() (if you have JMP16+)
-Jarmo