cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
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
julian
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);

julian
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