BookmarkSubscribeSubscribe to RSS Feed

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

galactus3000

Community Trekker

Joined:

Nov 9, 2016

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

Joined:

Jun 22, 2012

Solution

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
7 REPLIES
uday_guntupalli

Community Trekker

Joined:

Sep 15, 2014

@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

Staff

Joined:

Jun 25, 2014

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

Joined:

Jun 22, 2012

Solution

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

Community Trekker

Joined:

Nov 9, 2016

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

Community Trekker

Joined:

Nov 9, 2016

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

txnelson

Super User

Joined:

Jun 22, 2012

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

Joined:

Jul 13, 2011

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