- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Select where containing a date
I am trying to remove the rows in a column named date data ran in my script.
I have tried Select Where (Date Data Ran == 05/05/2014)
I have also tried Get Rows where (:Date Data Ran == 05/05/2014)
Along with about every option I can think of.
Any help would be appriciated.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Select where containing a date
Haven't see the date function. Is that something you wrote? Anyway this will do what you want:
dt = New Table( "Sample Table",
Add Rows( 4 ),
New Column( "Date Data Ran",
Numeric,
Continuous,
Format( "d/m/y", 12 ),
Input Format( "d/m/y" ),
Set Values( [3482092800, 3484771200, 3487363200, 3482092800] )
)
);
search_date = informat("05/05/2014", "d/m/y");
del_rows = dt << get rows where(:Date Data Ran == search_date);
dt << delete rows(del_rows);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Select where containing a date
Hi Vickie,
Dates get a bit tricky in how they're stored. Unless the date column is a character column (so the dates are really just strings) you'll need to search for that date based on its epoch time. Here's a way to get JMP to do that for you:
dt = Current Data Table();
searchDate = date(05/05/2014);
dt<<Select Where(:Date Data Ran == searchDate);
I hope this helps!
Julian
EDIT: See PMroz's suggestion -- my code will only work with additional code to define the date() function I used.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Select where containing a date
Haven't see the date function. Is that something you wrote? Anyway this will do what you want:
dt = New Table( "Sample Table",
Add Rows( 4 ),
New Column( "Date Data Ran",
Numeric,
Continuous,
Format( "d/m/y", 12 ),
Input Format( "d/m/y" ),
Set Values( [3482092800, 3484771200, 3487363200, 3482092800] )
)
);
search_date = informat("05/05/2014", "d/m/y");
del_rows = dt << get rows where(:Date Data Ran == search_date);
dt << delete rows(del_rows);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Select where containing a date
Oops-- thank you for catching that, PMroz! I use date() so often that I forgot it is a custom function I wrote to call informat with d/m/y. My apologies! PMroz's method is perfect.
Julian