cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
PowerOx327
Level II

How to get rows with more than one condition?

Hi,

 

I'm trying to get rows with more than one condition as so:

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
r = dt << Get Rows Where( :sex == "F", :name == "ROBERT", :name != "MARK" );
Show( r );

 

But what I'm getting is only rows where : sex == "F",

Is there any way to get all rows that are :name == "ROBERT", and also rows that are :name != "MARK"  i.e. the :name rows where it is not "MARK"

 

1 ACCEPTED SOLUTION

Accepted Solutions
Thierry_S
Super User

Re: How to get rows with more than one condition?

Hi,

Have you tried to build your condition as a logic statement (see below)?

 


r = dt << Get Rows Where( :sex == "F" | (:name == "ROBERT" | :name != "MARK" ));

 

This should return all the rows with Female, Roberts, or NOT Mark.

Best,

TS

Thierry R. Sornasse

View solution in original post

2 REPLIES 2
Thierry_S
Super User

Re: How to get rows with more than one condition?

Hi,

Have you tried to build your condition as a logic statement (see below)?

 


r = dt << Get Rows Where( :sex == "F" | (:name == "ROBERT" | :name != "MARK" ));

 

This should return all the rows with Female, Roberts, or NOT Mark.

Best,

TS

Thierry R. Sornasse
pmroz
Super User

Re: How to get rows with more than one condition?

The relevant logical operators in JSL are & for AND, | for OR, and ! for NOT.

Recommended Articles