- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to get rows with more than one condition?
Created:
Jul 25, 2022 12:55 AM
| Last Modified: Jul 25, 2022 12:25 AM
(871 views)
| Posted in reply to message from PowerOx327 07-24-2022
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
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to get rows with more than one condition?
Created:
Jul 25, 2022 12:55 AM
| Last Modified: Jul 25, 2022 12:25 AM
(872 views)
| Posted in reply to message from PowerOx327 07-24-2022
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to get rows with more than one condition?
The relevant logical operators in JSL are & for AND, | for OR, and ! for NOT.