Suppose your data table has a set of rows selected. Now, you want to select rows from that selection that meet an additional condition.
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" )
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.