I have five numerical columns. Need to create a new column reflecting the maximum values in each row of the five column. Instead of the returning the value I need to put the corresponding column name in each row.
It can be done with a column formula but it's easier with a small JSL script. The loop in the last line identifies the column with the highest value and puts its name in the new column "max". If several columns have the same maximum value, the first instance will be picked.
dt =Current Data Table();
cols = dt <<getcolumn names(numeric);
newcol = dt <<New Column("max", character);
For Each Row(newcol= cols[Loc Max(Matrix(cols))]<<get name);