My original goal was to color the cells in a single column based on whether the value of a certain cell is: within 1 sigma, > 1 sigma but <2 sigma, > 2 sigma but ❤️ sigma, and >3 sigma, the sigma is the standard deviation of the very column. Now I hope to iterate over all columns and execute the conditional coloring on all of them, but my for loop code as follows does not work. col=dt<<get column names(string);
nc=nitems(col);
for(i=2,i<=nc,i++,
mu = Col Mean( :Name(col[i]) );
sd = Col Std Dev( :Name(col[i]) );
lo = mu - 3*sd;
hi = mu + 3*sd;
rows = dt << Get Rows Where( lo <= :Name(col[i]) <= hi );
:Name(col[i]) << Color Cells( "Red", rows );
rows = dt << Get Rows Where( :Name(col[i])< lo | :Name(col[i])> hi );
:Name(col[i]) << Color Cells( "Purple", rows );
lo = mu - 2*sd;
hi = mu + 2*sd;
rows = dt << Get Rows Where( lo <= :Name(col[i]) <= hi );
:Name(col[i]) << Color Cells( "Yellow", rows );
lo = mu - sd;
hi = mu + sd;
rows = dt << Get Rows Where( lo <= :Name(col[i]) <= hi );
:Name(col[i]) << Color Cells( "Green", rows );
);
... View more