引用從循環創建的子集數據表我在引用循環生成的子集數據表時遇到一些問題。 該循環工作正常並創建名為 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)) << 新列("隨機", 數字, 連續, 公式(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 )
);