引用从循环创建的子集数据表我在引用循环生成的子集数据表时遇到一些问题。 该循环工作正常并创建名为 cond1、cond2 等的数据表,但如果我尝试在后面的代码中引用这些新创建的表,脚本日志会显示找不到它们。 奇怪的是,如果我单独运行我的脚本,它工作得很好。
for(i=1, i<=10, i++,
Original_table << select where(:排序条件== i);
dti = Original_table << 子集(
输出表("cond"||char(i)),
选定的行( 1 ),
仅选定的列( 0 )
);
);
datatable("cond"||char(i)) << 新列("随机", numeric, Continuous, 公式(round(Random Uniform(1,150)),0));
回复:从循环创建的参考子集数据表效果很好! 谢谢!
回复:从循环创建的参考子集数据表将新数据表引用 dt 插入到列表中可能会更简单,然后当您需要使用特定数据表时,可以在列表上添加下标或流式传输。
open tables = List();
For( i = 1, i <= 10, i++,
Original_table << select where( :Sorting Condition == i );
dti = Original_table << Subset(
Output table( "cond" || Char( i ) ),
Selected Rows( 1 ),
Selected columns only( 0 )
);
Insert Into( open tables, dti );
);
open tables[i] << New Column( "random",
numeric,
continuous,
formula( Round( Random Uniform( 1, 150 ) ), 0 )
);