cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

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

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.

1 ACCEPTED SOLUTION

Accepted Solutions
pmroz
Super User

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

View solution in original post

3 REPLIES 3
jules
Community Manager Community Manager

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.

pmroz
Super User

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

jules
Community Manager Community Manager

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

Recommended Articles