Subscribe Bookmark RSS Feed

Select where containing a date

vickie_moser

Community Member

Joined:

Jul 24, 2014

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

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);

3 REPLIES
julian

Staff

Joined:

Jun 25, 2014

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.

Solution

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);

julian

Staff

Joined:

Jun 25, 2014

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