Hello,
I am handling a bunch of csv logfiles. I want to use following approach to insert a column in a table if the string of file name matches a key word.
1. Import Multiple Files
2. Create table list of open files
3. Remove items not containing the key word
4. Insert formula column in matching table
5. Copy these values to a existing table
I am struggling with 4. and 5. Any ideas what I am doing wrong in my script below?
Thanks for your support.
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 ) )
);
You need to indicate in your attempt to add the new column that your openTable[I] is a 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 ) )
);