cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Kenobi
Level III

Hide and exclude in multiple select where

Hello,

 

I have an add-in that performs hide and exclude in a for loop. One thing I observed was that the previous hide and exclude gets overwritten by the next column condition. Additionally, I realized that it also overwrote my manual hide and exclude. I have two questions:

1. Is there a way to concatenate multiple select where and then perform an overall hide and exclude?

For( i = 1, i <= N Items( list_of_cols ), i++,
            dt << select where( As Column( dt, list_of_cols [i] ) != "");
            dt << hide and exclude;
)

2. Is there a way to keep the hide and exclude in place (manually performed in first two lines), and hide extra rows later on in the script?

dt << select where( :Comment =="Exclude");
dt << hide and exclude;

For( i = 1, i <= N Items( list_of_cols), i++,
        dt << select where( As Column( dt, list_of_cols[i] ) != "");
        dt << hide and exclude;
)

Thank you!

2 REPLIES 2
txnelson
Super User

Re: Hide and exclude in multiple select where

The Select Where() function has the ability to "Extend" or "Restrict" the previous Select Where.  See the Scripting Index for details.  Here is an example that shows how to do that for your application.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Select Where( :Age == 14 );
Wait( 0 );
dt << Select Where( :sex == "M", current selection( "extend" ) );
dt << hide and exclude;

Additionally, you could add to your Hide and Exclude, an additional option that only forces the selection to Turn On the Hide and Exclude

dt << Hide and Exclude(1);
For( i = 1, i <= N Items( list_of_cols ), i++,
            dt << select where( As Column( dt, list_of_cols [i] ) != "");
            dt << hide and exclude(1);
)
Jim
ErraticAttack
Level VI

Re: Hide and exclude in multiple select where

Good to know!

Jordan