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 )) )) )
);
)
);
);