- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Select rows based of multiple conditions
Hello,
I'm trying to select rows where either the second or third column have a value below 10^-9, or if there is a missing value in the 4th column. The problem appears to be with the less than operator and I cannot figure out why.
Example table:
Col1 | Col2 | Col3 | Col4 |
1 | 0.00000059 | 0.000000308 | A |
2 | 4.08e-9 | -8.1e-11 | B |
3 | -1.11e-10 | 1.02e-10 |
Here's the code:
dtColNames = dt << get ColumnNames("String");
val = 10^-9;
dt << Select Where((dt:dtColNames[2]<val | dt:dtColNames[3]<val ) | ismissing(dt:dtColNames[4]));
If I simplify this down to the following:
dtColNames = dt << get ColumnNames("String");
val = 10^-9;
dt << Select Where(dt:dtColNames[2]<val );
nothing is selected, when row 3 should be.
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Select rows based of multiple conditions
Created:
Apr 15, 2020 02:25 PM
| Last Modified: Apr 15, 2020 11:26 AM
(1679 views)
| Posted in reply to message from aserino 04-15-2020
A character string is not a column name or reference. You need to convert the string to a column reference.
dt << Select Where( Column( dt, dtColNames[2] )[] < val | Column( dt, dtColNames[3] )[] < val | ismissing( Column( dt, dtColNames[4] )[] ));
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Select rows based of multiple conditions
Created:
Apr 15, 2020 02:25 PM
| Last Modified: Apr 15, 2020 11:26 AM
(1680 views)
| Posted in reply to message from aserino 04-15-2020
A character string is not a column name or reference. You need to convert the string to a column reference.
dt << Select Where( Column( dt, dtColNames[2] )[] < val | Column( dt, dtColNames[3] )[] < val | ismissing( Column( dt, dtColNames[4] )[] ));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Select rows based of multiple conditions
Ah! Thanks!