Hey everyone,
I have a script I made to center a data column by a grouping column:

Right now it only respects one centered by column but I'd like to be able to put in multiple columns. Any guidance on how to make the formula more dynamic? Currently I just use this to start a new column then go in and manually add the addition columns to center by.
Names Default To Here( 1 );
dt = current data table();
results = Column Dialog(src=ColList("Cols to be centered", Min Col(1)),trg = ColList("centered by", Min Col(1)));
for(i=1, i<= n items(eval(results[1])), i++,
ts=expr(dt << New Column( "cent col", "Numeric",Formula(Expr(Eval( results[1] )[i]) - Col Mean( Expr(Eval( results[1] )[i]), Expr(Eval( results[2] )[1]) ))));
eval(eval expr(TS));
ts=expr(dt:"cent col"n<<set name(char(Eval( results[1] )[i])||" centered by "||char(Eval( results[2] )[1])));
eval(eval expr(TS));
);
Thanks for any input!