for循环中的问题大家好,我无法弄清楚为什么这个 for 循环公式不起作用。 如果单位是及时的,它只是创建一个新列,然后将其转换为小时。 样本数据也附上。 谢谢。
ColNames = dt << get column names( string, Numeric, character, continuous, Nominal );
N Items( ColNames );
For( i = 1, i <= N Items( ColNames ), i++,
If( Ends With( ColNames[i], "(secs)" ),
New Column (Concat(ColNames[i], "_to_", "Hr"), Formula(AS Column(ColNames[i])/3600) ),
Ends With( ColNames[i], "(min)" ),
New Column (Concat(ColNames[i], "_to_", "Hr"), Formula(AS Column(ColNames[i])/60) ),)
);
Wait( 0 );
脚本回复:for循环中的问题问题是公式元素不解析呈现的公式,然后将生成的代码放入公式中。因此,呈现给公式元素的内容必须正是公式所需的 JSL。下面是你的jsl的返工
Names Default To Here( 1 );
dt = Current Data Table();
ColNames = dt << get column names( string, Numeric, character, continuous, Nominal );
//N Items( ColNames );
For( i = 1, i <= N Items( ColNames ), i++,
If(
Ends With( ColNames[i], "(secs)" ),
New Column( Concat( ColNames[i], "_to_", "Hr" ),
Formula( Eval( Parse( ":\!"" || ColNames[i] || "\!"n / 3600" ) ) )
),
Ends With( ColNames[i], "(min)" ),
New Column( Concat( ColNames[i], "_to_", "Hr" ),
Formula( Eval( Parse( ":\!"" || ColNames[i] || "\!"n / 60" ) ) )
),
)
);回复:for 循环中的问题谢谢你,吉姆。它正在工作。
回复:for 循环中的问题感谢 Erratic,它正在工作。两种解决方案(来自 Jim 和您自己)都运行良好。但是您提供的解决方案 - 我从未见过(JSL Code())。谢谢。