Delete columns in different tables<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />Hi,
I try to delete columns on multiple tables.
In the second For loop I have an invalid argument. but works on the first table only...
Thanks
geof
Open("D:\A.csv");
Open("D:\B.csv");
Open("D:\C.csv");
t_count = N Table();
For(i = 1, i <= t_count, i++,
dt=Data Table(i);
N = N Col(dt);
ColumnstoKeep={"AA","BB"};
ColumnstoTrash = {};
For( j = 1, j <= N, j++,
colname = Column( j ) << getname(); / Debugger said invali argument !?/
If( Contains( ColumnstoKeep, colname ) < 1,
Insert Into( ColumnstoTrash, colname )
);
) ;
dt << delete columns( ColumnstoTrash );
);
Re: Delete columns in different tablesThanks very much 
Re: Delete columns in different tablesgeof2,
Your use of the column() function lacks a reference to the specific datatable you need, so you are operating on the current table only. This is the C.csv table, that last one you opened. Use Column( dt, j ). So, for your second loop, use:
For( j = 1, j <= N, j++,
colname = Column( dt, j ) << getname();
If( Contains( ColumnstoKeep, colname ) < 1,
Insert Into( ColumnstoTrash, colname )
);
) ;
I also recommend that you use something other than j for your index. j is a reserved function in JMP.
Michael