cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
%3CLINGO-SUB%20id%3D%22lingo-sub-46409%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%ED%98%84%EC%9E%AC%20%EC%84%A0%ED%83%9D%EB%90%9C%20%ED%96%89%EC%97%90%EC%84%9C%20%ED%96%89%20%EC%84%A0%ED%83%9D%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-46409%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CDIV%20class%3D%22lia-message-template-problem-zone%22%3E%0A%3CH2%20id%3D%22toc-hId--1330392677%22%20id%3D%22toc-hId-1731637459%22%20id%3D%22toc-hId-1731637459%22%3E%EB%AC%B8%EC%A0%9C%3C%2FH2%3E%0A%3CP%3E%EB%8D%B0%EC%9D%B4%ED%84%B0%20%ED%85%8C%EC%9D%B4%EB%B8%94%EC%97%90%20%ED%96%89%20%EC%A7%91%ED%95%A9%EC%9D%B4%20%EC%84%A0%ED%83%9D%EB%90%98%EC%96%B4%20%EC%9E%88%EB%8B%A4%EA%B3%A0%20%EA%B0%80%EC%A0%95%ED%95%A9%EB%8B%88%EB%8B%A4.%EC%9D%B4%EC%A0%9C%20%ED%95%B4%EB%8B%B9%20%EC%84%A0%ED%83%9D%20%ED%95%AD%EB%AA%A9%EC%97%90%EC%84%9C%20%EC%B6%94%EA%B0%80%20%EC%A1%B0%EA%B1%B4%EC%9D%84%20%EC%B6%A9%EC%A1%B1%ED%95%98%EB%8A%94%20%ED%96%89%EC%9D%84%20%EC%84%A0%ED%83%9D%ED%95%98%EB%A0%A4%EA%B3%A0%20%ED%95%A9%EB%8B%88%EB%8B%A4.%3C%2FP%3E%0A%3C%2FDIV%3E%0A%3CDIV%20class%3D%22lia-message-template-diagnosis-zone%22%3E%0A%3CH2%20id%3D%22toc-hId--442888996%22%20id%3D%22toc-hId--820519502%22%20id%3D%22toc-hId--820519502%22%3E%ED%95%B4%EA%B2%B0%EC%B1%85%3C%2FH2%3E%0A%3CP%3E%3CSPAN%3E%3CFONT%20color%3D%22%23000000%22%3E%EA%B7%B8%EB%A7%8C%ED%81%BC%3C%2FFONT%3E%20%EC%84%A0%ED%83%9D%20%EC%9C%84%EC%B9%98()%3CFONT%20color%3D%22%23000000%22%3E%20%EB%8D%B0%EC%9D%B4%ED%84%B0%20%ED%85%8C%EC%9D%B4%EB%B8%94%20%EA%B0%9C%EC%B2%B4%EC%97%90%20%EB%8C%80%ED%95%9C%20%EB%A9%94%EC%8B%9C%EC%A7%80%3C%2FFONT%3E%20%ED%98%84%EC%9E%AC%20%EC%84%A0%ED%83%9D%20%ED%95%AD%EB%AA%A9%EC%97%90%EC%84%9C%20%EC%84%A0%ED%83%9D%ED%95%98%EB%8F%84%EB%A1%9D%20%EC%A7%80%EC%A0%95%ED%95%A0%20%EC%88%98%20%EC%9E%88%EB%8A%94%20%EC%98%B5%EC%85%98%EC%9D%84%20%EC%A0%9C%EA%B3%B5%ED%95%A9%EB%8B%88%EB%8B%A4.%EB%8B%A4%EC%9D%8C%20%EC%98%88%EC%A0%9C%EC%97%90%EC%84%9C%EB%8A%94%20Current%20Selection()%20%EC%98%B5%EC%85%98%EC%9D%84%20%EC%82%AC%EC%9A%A9%ED%95%98%EC%97%AC%20%ED%98%84%EC%9E%AC%20%EC%84%A0%ED%83%9D%EB%90%9C%20%ED%96%89%EC%9C%BC%EB%A1%9C%EB%A7%8C%20%EC%83%88%20%EC%84%A0%ED%83%9D%EC%9D%84%20%EC%A0%9C%ED%95%9C%ED%95%98%EB%8A%94%20%EB%B0%A9%EB%B2%95%EC%9D%84%20%EB%B3%B4%EC%97%AC%EC%A4%8D%EB%8B%88%EB%8B%A4.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(%201%20)%3B%0A%0Adt%20%3D%20Open(%20%22%24SAMPLE_DATA%2FBig%20Class.jmp%22%20)%3B%0A%0A%2F*%20Establish%20the%20original%20row%20selection%20of%20students%20under%2014%20years%20old%20*%2F%0Adt%20%26lt%3B%26lt%3B%20Select%20Where(%20%3Aage%20%26lt%3B%2014%20)%3B%0A%0AWait(%201%20)%3B%20%2F%2FFor%20demonstration%20purposes%0A%0A%2F*%20Of%20the%20students%20less%20than%2014%2C%20select%20students%20who%20are%20also%20above%205ft%20in%20height%20*%2F%0Adt%20%26lt%3B%26lt%3B%20Select%20Where(%0A%20%3Aheight%20%26gt%3B%2060%2C%20%0A%20Current%20Selection(%20%22restrict%22%20)%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FDIV%3E%0A%3CDIV%20class%3D%22lia-message-template-solution-zone%22%3E%0A%3CH2%20id%3D%22toc-hId-444614685%22%20id%3D%22toc-hId-922290833%22%20id%3D%22toc-hId-922290833%22%3E%EB%85%BC%EC%9D%98%3C%2FH2%3E%0A%3CP%3ESelect%20Where()%EC%97%90%20%EB%8C%80%ED%95%9C%20Current%20Selection()%20%EC%98%B5%EC%85%98%EC%97%90%EB%8A%94%20%EC%84%B8%20%EA%B0%80%EC%A7%80%20%EC%98%B5%EC%85%98%EC%9D%B4%20%EC%9E%88%EC%8A%B5%EB%8B%88%EB%8B%A4.%3CSTRONG%3E%20%EC%96%BD%EB%A7%A4%EB%8B%A4%3C%2FSTRONG%3E%20%2C%3CSTRONG%3E%20%EC%97%B0%EC%9E%A5%ED%95%98%EB%8B%A4%3C%2FSTRONG%3E%20%2C%20%EA%B7%B8%EB%A6%AC%EA%B3%A0%3CSTRONG%3E%20%EB%B6%84%EB%AA%85%ED%95%9C%3C%2FSTRONG%3E%20.%EC%9C%84%EC%9D%98%20%EC%98%88%EB%8A%94%3CSTRONG%3E%20%EC%96%BD%EB%A7%A4%EB%8B%A4%3C%2FSTRONG%3E%20.%EA%B7%B8%EB%A7%8C%ED%81%BC%3CSTRONG%3E%20%EC%97%B0%EC%9E%A5%ED%95%98%EB%8B%A4%3C%2FSTRONG%3E%20%EC%9D%B8%EC%88%98%EB%A5%BC%20%EC%82%AC%EC%9A%A9%ED%95%98%EB%A9%B4%20%EC%9B%90%EB%9E%98%20%EC%84%A0%ED%83%9D%ED%95%9C%20%ED%96%89%EC%97%90%20%EC%98%81%ED%96%A5%EC%9D%84%20%EC%A3%BC%EC%A7%80%20%EC%95%8A%EA%B3%A0%20%EC%B6%94%EA%B0%80%20%ED%96%89%EC%9D%84%20%EC%84%A0%ED%83%9D%ED%95%A0%20%EC%88%98%20%EC%9E%88%EC%8A%B5%EB%8B%88%EB%8B%A4.%EA%B7%B8%EB%A7%8C%ED%81%BC%3CSTRONG%3E%20%EB%B6%84%EB%AA%85%ED%95%9C%3C%2FSTRONG%3E%20%EC%9D%B8%EC%88%98%EB%8A%94%20%EC%83%88%EB%A1%9C%EC%9A%B4%20%EC%84%A0%ED%83%9D%EC%9D%84%20%ED%95%98%EA%B8%B0%20%EC%A0%84%EC%97%90%20%EB%AA%A8%EB%93%A0%20%ED%96%89%EC%9D%98%20%EC%84%A0%ED%83%9D%EC%9D%84%20%EC%B7%A8%EC%86%8C%ED%95%A9%EB%8B%88%EB%8B%A4.%EC%9D%B4%20%EB%8F%99%EC%9E%91%EC%9D%80%20Select%20Where()%EC%97%90%EC%84%9C%20Current%20Selection()%20%EC%98%B5%EC%85%98%EC%9D%B4%20%EC%A7%80%EC%A0%95%EB%90%98%EC%A7%80%20%EC%95%8A%EC%9D%80%20%EA%B2%BD%EC%9A%B0%EC%99%80%20%EB%8F%99%EC%9D%BC%ED%95%A9%EB%8B%88%EB%8B%A4.%3C%2FP%3E%3CSPAN%3ESelect%20Where()%20%EC%82%AC%EC%9A%A9%EC%97%90%20%EB%8C%80%ED%95%9C%20%EB%8D%94%20%EB%A7%8E%EC%9D%80%20%EC%98%88%EB%8A%94%20%EB%8B%A4%EC%9D%8C%EC%97%90%EC%84%9C%20%EC%B0%BE%EC%9D%84%20%EC%88%98%20%EC%9E%88%EC%8A%B5%EB%8B%88%EB%8B%A4.%3C%2FSPAN%3E%3CA%20href%3D%22http%3A%2F%2Fwww.jmp.com%2Fsupport%2Fhelp%2F13-2%2FSelect_Rows_2.shtml%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3E%20%ED%96%89%20%EC%84%A0%ED%83%9D%3C%2FA%3E%3CSPAN%3E%20%EC%84%B9%EC%85%98%EC%9D%84%20%EC%B0%B8%EC%A1%B0%ED%95%98%EC%8B%AD%EC%8B%9C%EC%98%A4.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId-1332118366%22%20id%3D%22toc-hId--1629866128%22%20id%3D%22toc-hId--1629866128%22%3E%EB%98%90%ED%95%9C%EB%B3%B4%EC%8B%AD%EC%8B%9C%EC%98%A4%3C%2FH2%3E%0A%3CP%3E%3CA%20id%3D%22link_2_1116c9e380b7bb6_0_2dfe1%22%20class%3D%22page-link%20lia-link-navigation%20lia-custom-event%22%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2FJSL-Cookbook%2FSelect-rows-based-upon-multiple-conditions%2Fta-p%2F46404%22%20target%3D%22_blank%22%3E%EC%97%AC%EB%9F%AC%20%EC%A1%B0%EA%B1%B4%EC%97%90%20%EB%94%B0%EB%9D%BC%20%ED%96%89%20%EC%84%A0%ED%83%9D%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2FJSL-Cookbook%2FSelect-rows-that-match-any-value-in-a-list%2Fta-p%2F46411%22%20target%3D%22_blank%22%3E%EB%AA%A9%EB%A1%9D%EC%9D%98%20%EA%B0%92%EA%B3%BC%20%EC%9D%BC%EC%B9%98%ED%95%98%EB%8A%94%20%ED%96%89%20%EC%84%A0%ED%83%9D%3C%2FA%3E%3C%2FP%3E%0A%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-402746%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20%ED%98%84%EC%9E%AC%20%EC%84%A0%ED%83%9D%EB%90%9C%20%ED%96%89%EC%97%90%EC%84%9C%20%ED%96%89%20%EC%84%A0%ED%83%9D%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-402746%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%EB%A7%A4%EC%9A%B0%20%EB%8F%84%EC%9B%80%EC%9D%B4%20%EB%90%A9%EB%8B%88%EB%8B%A4.%20%EC%A0%95%EB%A7%90%20%EA%B0%90%EC%82%AC%ED%95%A9%EB%8B%88%EB%8B%A4!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-105384%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20%ED%98%84%EC%9E%AC%20%EC%84%A0%ED%83%9D%EB%90%9C%20%ED%96%89%EC%97%90%EC%84%9C%20%ED%96%89%20%EC%84%A0%ED%83%9D%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-105384%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%EC%9C%A0%EC%9A%A9%ED%95%9C%20%ED%8C%81%20%EA%B0%90%EC%82%AC%ED%95%A9%EB%8B%88%EB%8B%A4!%3C%2FP%3E%3C%2FLINGO-BODY%3E
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.