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
galactus3000
Level IV

In JSL, with rows already selected, how do I select a subset of those cells which are in a column

In JSL, with rows already selected, how do I select a subset of those cells which are in a column.

For instance, if rows 4, 12, 180, and 205 are already selected (for example), how do I subselect just the overlap cells of that and a certain column (column 10 for example) or columns (10,12 and 17 say). 

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: In JSL, with rows already selected, how do I select a subset of those cells which are in a colum

I am not sure that @julian or @uday_guntupalli are interpreting your question properly.  What I believe you are asking, is "How do you reference the selected rows for a specific column, or set of columns.

JMP allows one to access any given cell by the column name or number, and the row number.  Selected rows can be accessed by getting back from JMP a list of the rows that have been selected.  Below is a little script that shows some of the uses

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );

dt << select where( :Age > 15 );

// Examples
Show( dt << get selected rows );
Show( :name[dt << get selected rows] );
Show( :Name[(dt << get selected rows)[2]], 
	:age[(dt << get selected rows)[2]] );
Jim

View solution in original post

7 REPLIES 7
uday_guntupalli
Level VIII

Re: In JSL, with rows already selected, how do I select a subset of those cells which are in a colum

@galactus3000,
     You can leverage the "restrict" function similar to how extend has been used below. 

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Select Rows( [5, 7, 8, 10, 15] ); // For demo purpose only 
dt << Label( 1 );
dt << Clear Select;
Wait( 2 );
dt << Select Labeled; 
dt << Select Where(:age > 12,"extend"); 

   I missed the subselect part until I saw @julian's post. 

Best
Uday
julian
Community Manager Community Manager

Re: In JSL, with rows already selected, how do I select a subset of those cells which are in a colum

Hi @galactus3000,

Select Where() allows you to extend, restrict, or clear previous selections:

Select Where( condition, <Current Selection( "extend" | "restrict" | "clear" )> );

For your situation, it sounds like you'll want to restrict to your previously selected rows. 

dt = Open("$SAMPLE_DATA\Big Class.jmp");
dt << Select Where( :age>14 );
Wait(1);
dt << Select Where( :sex=="F", Current Selection( "restrict" ));

I hope this helps!

@julian

txnelson
Super User

Re: In JSL, with rows already selected, how do I select a subset of those cells which are in a colum

I am not sure that @julian or @uday_guntupalli are interpreting your question properly.  What I believe you are asking, is "How do you reference the selected rows for a specific column, or set of columns.

JMP allows one to access any given cell by the column name or number, and the row number.  Selected rows can be accessed by getting back from JMP a list of the rows that have been selected.  Below is a little script that shows some of the uses

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );

dt << select where( :Age > 15 );

// Examples
Show( dt << get selected rows );
Show( :name[dt << get selected rows] );
Show( :Name[(dt << get selected rows)[2]], 
	:age[(dt << get selected rows)[2]] );
Jim
galactus3000
Level IV

Re: In JSL, with rows already selected, how do I select a subset of those cells which are in a colum

this is great ... thanks!

I want to place the value "1" in a certain column for which rows have been selected by the Process Capability --> Select out of spec values option

 

for each out of spec value in column A, I want to place a "1" in same row of column B.

galactus3000
Level IV

Re: In JSL, with rows already selected, how do I select a subset of those cells which are in a colum

ah ... so the [2] will refer to the 2nd selected row 

txnelson
Super User

Re: In JSL, with rows already selected, how do I select a subset of those cells which are in a colum

All of the selected rows can be set with one statement

:age[(dt << get selected rows)] = 12;

In the above statement, all rows that have been selected, will be set to 12

Jim
David_Burnham
Super User (Alumni)

Re: In JSL, with rows already selected, how do I select a subset of those cells which are in a colum

The selected rows form a row-matrix that can be used to subset a column:

rows = dt << get selected rows;   
subsetValues = Column(10)[rows];	
-Dave