從打開的表列表中調用表並按匹配條件插入列你好,
我正在處理一堆csv日誌文件。如果文件名的字符串與關鍵字匹配,我想使用以下方法在表中插入一列。
1。導入多個文件
2。創建打開文件的表列表
3。刪除不包含關鍵字的項目
4。在匹配表中插入公式列
5,將這些值複製到現有表中
我正在為4。和5。有什麼想法我在下面的腳本中做錯了嗎?
謝謝你的支持。
BR
Names Default To Here( 1 );
// Create list of open tables
openTables = {};
For( i = 1, i <= N Table(), i++,
Insert Into( openTables, Data Table( i ) << getName )
);
Sort List Into( openTables );
Show( openTables );
// Delete files excluding BFS
For( i = N Items( openTables ), i > 0, i--,
If( !Contains( openTables[i], "BFS" ),
Remove From( openTables, i )
)
);
Show( openTables );
// Insert column in matching table
For( i = N Items( openTables ), i > 0, i--,
openTables[i] << New Column( "test", set each value( 3 ) )
);
回复:從打開的表列表中調用表並通過匹配條件插入列您需要在嘗試添加新列時指出openTable [I]是Data Table()。
Names Default To Here( 1 );
// Create list of open tables
openTables = {};
For( i = 1, i <= N Table(), i++,
Insert Into( openTables, Data Table( i ) << getName )
);
Sort List Into( openTables );
Show( openTables );
// Delete files excluding BFS
For( i = N Items( openTables ), i > 0, i--,
If( !Contains( openTables[i], "BFS" ),
Remove From( openTables, i )
)
);
Show( openTables );
// Insert column in matching table
For( i = N Items( openTables ), i > 0, i--,
Data Table( openTables[i] ) << New Column( "test", set each value( 3 ) )
);