cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
Select rows from the currently selected rows

Problem

Suppose your data table has a set of rows selected.  Now, you want to select rows from that selection that meet an additional condition.

Solution

The Select Where() message for the Data Table object offers an option that allows you to specify to select from the current selection. The following example demonstrates how to use the Current Selection() option to restrict the new selection to the currently selected rows only.

 

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

/* Establish the original row selection of students under 14 years old */
dt << Select Where( :age < 14 );

Wait( 1 ); //For demonstration purposes

/* Of the students less than 14, select students who are also above 5ft in height */
dt << Select Where(
 :height > 60, 
 Current Selection( "restrict" )
);

 

Discussion

The Current Selection() option for Select Where() has three options: restrict, extend, and clear.  The above example demonstrated the use of restrict.  The extend argument allows you to select additional rows without affecting the original selected rows.  The clear argument deselects all rows before making the new selection.  This behavior is the same as if the Current Selection() option was not specfied in the Select Where().

Many more examples of using Select Where() can be found in the Select Rows section of the JMP Scripting Guide.

See Also

Select rows based upon multiple conditions 

Select rows that match any value in a list

Comments

Thanks for the helpful tip!

shaira

Very helpful. Thanks a lot!

JSL Cookbook

If you’re looking for a code snippet or design pattern that performs a common task for your JSL project, the JSL Cookbook is for you.

This knowledge base contains building blocks of JSL code that you can use to reduce the amount of coding you have to do yourself.

It's also a great place to learn from the experts how to use JSL in new ways, with best practices.