Eval Expr 無法正常運作我一直對這個問題感到困惑。這個公式是我根據之前一個有效的公式修改而來的。
// Get the current data table
dt = Current Data Table();
colNames = dt << get column names( continuous, string );
// Loop through all columns
For each( {col}, colNames,
Eval(
Eval Expr(
New Column(
Expr( col ) || "_Gouge",
Numeric,
"Continuous",
Format( "Best", 10 ),
Formula( (Mean( As Column( Eval(col) ) [Index(1, 100)]) + Mean(As Column(Eval(col)) [Index(N Rows() - 99, N Rows())])) / 2 - Col Minimum(As Column(Eval(col)) ) )
);
)
);
);
該公式似乎尚未得到評估。
自動化和腳本編寫回覆:Eval Expr 無法正常運作As Column( Eval( col ) ) 應改為 As Column( Expr( col ) );
回覆:Eval Expr 無法正常運作成品看起來是這樣的。
// Get the current data table
dt = Current Data Table();
colNames = dt << get column names( continuous, string );
// Loop through all columns
For each( {col}, colNames,
Eval(
Eval Expr(
New Column(
Expr( col ) || "_Gouge",
Numeric,
"Continuous",
Format( "Best", 10 ),
Formula( (Mean( As Column( Expr( col ) ) [Index(1, 100)]) + Mean(As Column( Expr( col ) ) [Index(N Rows() - 99, N Rows())])) / 2 - Col Minimum(As Column( Expr( col )) ) )
);
)
);
);
回覆:Eval Expr 無法正常運作您也可以使用以下程式碼。它會建立列引用,看起來就像是在公式編輯器中新增的列一樣。
其中一個優點是:即使輸入列被重新命名,公式仍然有效。
dt = Current Data Table();
colNames = dt << get column names( continuous, string );
// Loop through all columns
For each( {col}, colNames,
Eval(
Eval Expr(
New Column(
col || "_Gouge",
Numeric,
"Continuous",
Format( "Best", 10 ),
Formula( (Mean( Expr(Name Expr(As Column( col ) )) [Index(1, 100)]) + Mean(Expr(Name Expr(As Column( col ) )) [Index(N Rows() - 99, N Rows())])) / 2 - Col Minimum(Expr(Name Expr(As Column( col )) )) )
);
)
);
);