cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
poulravn
Level IV

How to select rows based on multiple criteria?

Hi,

I am writing a script to Subset a data table. Following the scripting guids' coding example I can select according to a criterium:

for each row(Selected(Rowstate())=(name=="KATIE"));

How can I generalize this to select both KATIE and LOUISE?

This does not work:

for each row(Selected(Rowstate())=(name=="KATIE","LOUISE"));

So what is the syntax for this?

Regards

Poul

   

10 REPLIES 10
pmroz
Super User

Re: How to select rows based on multiple criteria?

This syntax might be a little more readable.  You can use the vertical bar for OR, and the ampersand for AND:

dt = open("$sample_data\Big Class.jmp");

dt << select where((contains(:name, "ATIE") | contains(:name, "OBER"))

                                      & contains(:sex, "F"));