你好,
我正在尝试替换所附数据表中的所有失败单元格,其中1以红色突出显示,而通过单元格则以0 突出显示。

找到了这个,但有些东西不起作用-
如何使用 JSL 获取数据表中特定单元格的颜色?
有没有更好的方法来替换单元格值?
这是我尝试过的
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;谢谢,
如何获取列中彩色单元格的行数并在新建的列中为其分配标签(例如“1”)?可能会提供其他建议。对create_failed_column_after进行小幅修改(您还应该重命名它),您可以让它更新值,而不是使用这些值创建新列。