从打开的表列表中调用表并按匹配条件插入列你好,
我正在处理一堆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 ) )
);