你好,
我正在嘗試替換附加資料表中的所有失敗單元格,該單元格以紅色突出顯示為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進行小修改(您也應該重命名它),您可以讓它更新值,而不是使用值建立新列。