やあ、
次の「TestData」があります。

1.ステータスがダウンのときにセルの値をnullにしたい。たとえば、("A status" セルの値は "down" で、列 "A" の値は "1334" ではなく null にする必要があります。B 、C および D 列についても同じことを行う必要があります。
2.列名に「ステータス」が含まれる列をすべて削除します。
出力は次のようになります。


3. これで、同じタイムスタンプ行がすべてマージされます。予想される出力は次のようになります:(要約[グループ化と合計]を使用してこれを達成できることはわかっています。 しかし、JSLでそれを行うより良い方法はありますか?)

複数のcsvファイルに対してこれを行う必要があります。 このためのJSLの作成を誰かが手伝ってくれますか。
よろしくお願いします。
これで問題は解決するはずですが、スクリプトはステータス列がその直前の列に対応していると想定しています。ステータス列の名前を見て、同じ名前から「ステータス」を除いた列を見つけることでこれを行うことができますが、仮定が正しい場合、それは不必要に複雑であると考えました。
dt = Current Data Table();
col_names = dt << Get Column Names(string);
//Assuming the corresponding value column for each status column is always the preceding one
//Loop backwards through the columns
for(i = N Col(dt), i>= 1, i--,
//If column name has word "status" in it
if(Contains(Lowercase(col_names[i]), "status") > 0,
//Look for instances of "{down}"
down_rows = dt << Get Rows Where( dt:(As Name(col_names[i])) == "{down}" );
//Assuming preceding column is the value column, replace {down} rows with missing
Column(dt, i-1)[down_rows] = .;
dt << Delete Columns(i);
);
);
//Create table summary to consolidate time stamp rows with same value
//Build a string that we can parse for the summary operation
remaining_cols = dt << Get Column Names("string");
summary_str = "dt_clean = dt << Summary( Group( :TimeStamp ), ";
//Loop through all columns except TimeStamp to add "Sum( <CURRENT col=""> )" to summary string
for(i = 2, i <= N Col(dt), i++,
summary_str = summary_str||"Sum( :Name(\!""||remaining_cols[i]||"\!")), ";
);
//Attach last part of script
summary_str = summary_str||"Freq( \!"None\!"),
Weight(\!"None\!"),
statistics column name format( \!"column\!" ),
Link to original data table( 0 ),
output table name( \!"CleanedData\!" ));";
//Parse and evaluate the string to create the summary table dt_new
eval(parse(summary_str));
//Delete N Rows column
dt_clean << Delete Columns(:N Rows);</CURRENT>