This website uses Cookies. Click Accept to agree to our website's cookie use as described in our Privacy Policy. Click Preferences to customize your cookie settings.
Is there any better way to replace the cell values?
Here is what I tried
Names Default To Here( 1 );
dt = Current Data Table();
cols = dt << get column group( "Tests" );
get_cell_color = Function( {col, r},
s = col << get script;
//Locate argument "Color Cells" in column script
For( i = 1, i <= N Arg( s ), i++,
If( Head Name( Arg( s, i ) ) == "Color Cells",
p = i;
Break();
)
);
//Identify the sublist that contains the color of row r
L = Arg( Arg( s, p ), 1 );
For( i = 1, N Items( L ), i++,
If( N Row( Loc( L[i][2], r ) ) == 1,
color = L[i][1];
Break();
)
);
color;
);
//
test_cols = Transform Each( {col}, cols, col << get name );
dt << Select All Rows;
selrow = dt << get Selected Rows();
dt << begin data update;
For Each( {testcol, idx}, test_cols,
For Each( {ro, idx2}, selrow,
cellcolor = get_cell_color( Column( testcol ), ro );
If( !cellcolor == 3,
Column( testcol )[ro] = 0
)
;
)
);
dt << end data update;