cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
%3CLINGO-SUB%20id%3D%22lingo-sub-46409%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ES%C3%A9lectionner%20des%20lignes%20parmi%20les%20lignes%20actuellement%20s%C3%A9lectionn%C3%A9es%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-1732437758%22%20id%3D%22toc-hId-1732437758%22%3EProbl%C3%A8me%3C%2FH2%3E%0A%3CP%3ESupposons%20que%20votre%20table%20de%20donn%C3%A9es%20comporte%20un%20ensemble%20de%20lignes%20s%C3%A9lectionn%C3%A9es.Maintenant%2C%20vous%20souhaitez%20s%C3%A9lectionner%20les%20lignes%20de%20cette%20s%C3%A9lection%20qui%20remplissent%20une%20condition%20suppl%C3%A9mentaire.%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--819719203%22%20id%3D%22toc-hId--819719203%22%3ESolution%3C%2FH2%3E%0A%3CP%3E%3CSPAN%3E%3CFONT%20color%3D%22%23000000%22%3ELe%3C%2FFONT%3E%20S%C3%A9lectionnez%20O%C3%B9()%3CFONT%20color%3D%22%23000000%22%3E%20message%20pour%20l'objet%20Table%20de%20donn%C3%A9es%3C%2FFONT%3E%20offre%20une%20option%20qui%20vous%20permet%20de%20sp%C3%A9cifier%20de%20s%C3%A9lectionner%20%C3%A0%20partir%20de%20la%20s%C3%A9lection%20actuelle.L'exemple%20suivant%20montre%20comment%20utiliser%20l'option%20Current%20Selection()%20pour%20limiter%20la%20nouvelle%20s%C3%A9lection%20aux%20lignes%20actuellement%20s%C3%A9lectionn%C3%A9es%20uniquement.%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-923091132%22%20id%3D%22toc-hId-923091132%22%3EDiscussion%3C%2FH2%3E%0A%3CP%3EL'option%20Current%20Selection()%20pour%20Select%20Where()%20a%20trois%20options%26nbsp%3B%3A%3CSTRONG%3E%20limiter%3C%2FSTRONG%3E%20%2C%3CSTRONG%3E%20%C3%A9tendre%3C%2FSTRONG%3E%20%2C%20et%3CSTRONG%3E%20clair%3C%2FSTRONG%3E%20.L'exemple%20ci-dessus%20a%20d%C3%A9montr%C3%A9%20l'utilisation%20de%3CSTRONG%3E%20limiter%3C%2FSTRONG%3E%20.Le%3CSTRONG%3E%20%C3%A9tendre%3C%2FSTRONG%3E%20L'argument%20vous%20permet%20de%20s%C3%A9lectionner%20des%20lignes%20suppl%C3%A9mentaires%20sans%20affecter%20les%20lignes%20s%C3%A9lectionn%C3%A9es%20d'origine.Le%3CSTRONG%3E%20clair%3C%2FSTRONG%3E%20L'argument%20d%C3%A9s%C3%A9lectionne%20toutes%20les%20lignes%20avant%20d'effectuer%20la%20nouvelle%20s%C3%A9lection.Ce%20comportement%20est%20le%20m%C3%AAme%20que%20si%20l'option%20Current%20Selection()%20n'%C3%A9tait%20pas%20sp%C3%A9cifi%C3%A9e%20dans%20Select%20Where().%3C%2FP%3E%3CSPAN%3EVous%20trouverez%20de%20nombreux%20autres%20exemples%20d'utilisation%20de%20Select%20Where()%20dans%20le%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%20S%C3%A9lectionnez%20les%20lignes%3C%2FA%3E%3CSPAN%3E%20section%20du%20Guide%20de%20cr%C3%A9ation%20de%20scripts%20JMP.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId-1332118366%22%20id%3D%22toc-hId--1629065829%22%20id%3D%22toc-hId--1629065829%22%3EVoir%20%C3%A9galement%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%3ES%C3%A9lectionner%20des%20lignes%20en%20fonction%20de%20plusieurs%20conditions%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%3ES%C3%A9lectionner%20les%20lignes%20qui%20correspondent%20%C3%A0%20n'importe%20quelle%20valeur%20dans%20une%20liste%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%26nbsp%3B%3A%20S%C3%A9lectionner%20des%20lignes%20parmi%20les%20lignes%20actuellement%20s%C3%A9lectionn%C3%A9es%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-402746%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3ETr%C3%A8s%20utile.%20Merci%20beaucoup!%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%26nbsp%3B%3A%20S%C3%A9lectionner%20des%20lignes%20parmi%20les%20lignes%20actuellement%20s%C3%A9lectionn%C3%A9es%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-105384%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EMerci%20pour%20le%20conseil%20utile%26nbsp%3B!%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.