Choose Language Hide Translation Bar
Highlighted
aumair
Level III

Exclude selected columns

Hello, 

I get a varying list of columns from a source and select these columns in my data table. The data table has many other columns, but I want to hide/exclude the columns which are not in the list provided to me while my script is running and doing some analysis...

 

I can select all the columns which I don't need by line below:

dt < <invert column selection (Provided_List) 

Next step: Exclude these selected columns. How do I do that?

 

From scripting book, I can see column("X") << exclude(1) would exclude the column with name X, but is there a method to exclude already selected columns?

Thanks. 

2 REPLIES 2
Highlighted
txnelson
Super User

Re: Exclude selected columns

Here is the syntax of how to do this:

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );

Column( dt, 4 ) << set selected( 1 );
Column( dt, 5 ) << set selected( 1 );

selcols = dt << get selected columns;
For( i = 1, i <= N Items( selcols ), i++,
	Column( dt, selcols[i] ) << exclude( 1 )
);
Jim
Highlighted
aumair
Level III

Re: Exclude selected columns

Thanks!!! I also figured that out but it was a bit longer. This is perfect :)

Article Labels

    There are no labels assigned to this post.