すべての列を調べ、値が「< LOD」のセルを色で表示するスクリプトが必要です。スクリプトでは期待どおりの結果が得られません。何かアドバイスはありますか?
dt = Current Data Table();
// Get all of the column names in the data table
ColNames = dt << get column names( string );
NRows = N Rows( dt );
// Loop through each column and row to find "< LOD" and color the previous cell
For( i = 1, i <= N Items( ColNames ), i++,
column = Column( dt, ColNames[i] );
For( j = 2, j <= NRows, j++, // Start at row 2 to avoid coloring out-of-bound cells
If( Row(j) == "< LOD",
column << Color Cells( j - 1, "Red" );
)
);
);
その他の、よりエレガントなソリューションも大歓迎です!
これは値「F」を探しますが、変更できる内容についていくつかのアイデアが示される可能性があります (各列のすべての行を事前に取得する、セルの引数の順序を色分けする、...)
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
colnames = dt << get column names(character, string);
For Each({colname}, colnames,
r = Loc(dt[0, colname], "F");
If(N Items(r) > 0,
Column(dt, colname) << Color Cells("Red", r);
);
);
Write();
編集: ループから不要な Show(r); を削除しました