Select All Rows selects (or highlights) all of the rows in a data table.
dt << Select All Rows;
If all rows are selected, you can deselect them all by using Invert Row Selection. This command reverses the selection state for each row, so that any selected rows are deselected, and any deselected rows are selected.
dt << Invert Row Selection;
Note: With the exception of Invert Row Selection, whose result depends on the current selection, any new selection message starts over with a new selection. If you already have certain rows selected and you then send a new message to select rows, all rows are first deselected.
dt << Go To Row( 9 );
To select specific rows in a data table based on their row number, use the Select Rows command. The argument to the command is a list of row numbers. For example, to select rows 1, 3, 5, and 7 of a data table, proceed as follows:
dt << Select Rows( {1, 3, 5, 7} );
dt << Select Rows( Index( 7, 10 ) );
dt << Select Where( Any( Row() == Index( 7, 10 ) ) );
To select rows according to data values, use Select Where, specifying a logical test inside the parentheses.
For example, using the Big Class.jmp sample data table, select the rows where the students’ age is greater than 13:
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Select Where( :age > 13 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
col = Column( dt, 2 );
dt << Select Where( col[] < 14 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Select Where( :age < 15 & :sex == "F" );
To select a row without deselecting a previously selected row, combine << Select Where with << Select Where and the Current Selection("extend") argument. This is an alternative to using an OR statement.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Select Where( :age == 14 );
dt << Select Where( :sex == "F", Current Selection( "extend" ) );
dt = Open( "$SAMPLE_DATA/Hollywood Movies.jmp" );
my_genres = {"Romance", "Comedy"};
dt << Select Where( Contains( my_genres, :Genre ) );
When you use column references to refer to column names in a Where statement, the column references need to be evaluated so they can be resolved to the proper data table. For example, in the following script, the parameters to the X(Xcol) and Y(Ycol) column references are linked to the data table in dt. However, the execution of the platform is associated with the Where subset data table. The script produces an error.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
Ycol = Column( dt, "weight" ); // column reference to weight
Xcol = Column( dt, "height" ); // column reference to height
dt << Bivariate( Y( Ycol ), X( Xcol ), Fit Line(), Where( :sex == "F" ) );
To evaluate the column names to the correct data table, use an Eval() expression or refer to the column names directly.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Bivariate(
	Y( Eval( Ycol ) ), // or Y( :weight )
	X( Eval( Xcol ) ), // or X( :height )
	Fit Line(),
	Where( :sex == "F" )
);
dt << Select Excluded;
dt << Select Hidden;
dt << Select Labeled;
To select rows that are not excluded, hidden, or labeled, stack a select message and an invert selection message together in the same statement, or send the two messages sequentially:
dt << Select Hidden << Invert Row Selection;
dt << Select Hidden;
dt << Invert Row Selection;
dt = Open( "$SAMPLE_DATA/San Francisco Crime.jmp" );
dt << Select Duplicate Rows(); // selects rows 301 and 8864
dt = Open( "$SAMPLE_DATA/San Francisco Crime.jmp" );
dt << Select Duplicate Rows();
dt << Exclude();
dt = Open( "$SAMPLE_DATA/San Francisco Crime.jmp" );
dt << Select Duplicate Rows( Match( Column( "Incident Number" ), :Time ) );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Select Duplicate Rows( Match( :age ) );
dt << Select Where( :age > 15, Current Selection( "restrict" ) );
To refer to a specific cell, assign a subscript to the cell’s row number. In the following example, the subscript [1] is used with the weight column. The formula then calculates the ratio between each height and the first value in the weight column.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
New Column( "ratio", Formula( height / weight[1] ) );
dt << Select Randomly( number );
dt << Select Randomly( probability );
The row menu command Select Matching Cells is also implemented in JSL.
dt << Select Matching Cells;
// select matching cells in the current data table
dt << Select All Matching Cells;
// select matching cells in all open data tables.

Help created on 7/12/2018