<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How do I select rows between date ranges in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-do-I-select-rows-between-date-ranges/m-p/29585#M19525</link>
    <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to figure out how to select rows specific to a range of dates using data from a column by last date.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to do this in a for loop?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 487px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/4129iA74A3C97D9B8D555/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 27 Nov 2016 05:51:02 GMT</pubDate>
    <dc:creator>steven_w_daniel</dc:creator>
    <dc:date>2016-11-27T05:51:02Z</dc:date>
    <item>
      <title>How do I select rows between date ranges</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-select-rows-between-date-ranges/m-p/29585#M19525</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to figure out how to select rows specific to a range of dates using data from a column by last date.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to do this in a for loop?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 487px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/4129iA74A3C97D9B8D555/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2016 05:51:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-select-rows-between-date-ranges/m-p/29585#M19525</guid>
      <dc:creator>steven_w_daniel</dc:creator>
      <dc:date>2016-11-27T05:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I select rows between date ranges</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-select-rows-between-date-ranges/m-p/29586#M19526</link>
      <description>&lt;P&gt;The specific intent is to separate the new part ID from the old part ID&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2016 12:59:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-select-rows-between-date-ranges/m-p/29586#M19526</guid>
      <dc:creator>steven_w_daniel</dc:creator>
      <dc:date>2016-11-27T12:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I select rows between date ranges</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-select-rows-between-date-ranges/m-p/29587#M19527</link>
      <description>&lt;P&gt;Here is a simple solution using Select Where:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();
dt &amp;lt;&amp;lt; select where(
	:Date &amp;gt; Informat( "20Dec2015:00:00:00", "MDYHMS" ) &amp;amp; 
	:Date &amp;lt;= Informat( "20Dec2016:00:00:00", "MDYHMS" )
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can also accomplish this interactively by using the pull down menu for the data table:&lt;/P&gt;
&lt;P&gt;Rows==&amp;gt;Row Selection==&amp;gt;Select Where&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2016 16:40:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-select-rows-between-date-ranges/m-p/29587#M19527</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2016-11-27T16:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do I select rows between date ranges</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-select-rows-between-date-ranges/m-p/29588#M19528</link>
      <description>&lt;P&gt;In this case, if the dates are fixed, then you can use a literal or constant value. It looks just like the string above but it is not enclosed in double quotation marks. JMP will interpret (and display) this value as the appropriate date and time. That is, you only need to enter&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="token string"&gt;Date &amp;gt; 20Dec2015:00:00:00&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;in this case. This way is more concise and elminates the need to deal with formats and concersons. You do not need to use the full specification either. This much is sufficient:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="token string"&gt;Date &amp;gt; 20Dec2015&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 27 Nov 2016 18:05:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-select-rows-between-date-ranges/m-p/29588#M19528</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2016-11-27T18:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I select rows between date ranges</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-select-rows-between-date-ranges/m-p/30936#M19623</link>
      <description>&lt;P&gt;I guess I didn't explain myself too well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First I want to select all rows with the last date;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;dt &amp;lt;&amp;lt; select where(name ("Date") == col Max(:Date));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Next I want to select only the rows with the PART ID that corresponds to the latest PART ID (id est the max date)&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2016 05:20:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-select-rows-between-date-ranges/m-p/30936#M19623</guid>
      <dc:creator>steven_w_daniel</dc:creator>
      <dc:date>2016-12-01T05:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I select rows between date ranges</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-select-rows-between-date-ranges/m-p/30937#M19624</link>
      <description>&lt;P&gt;I guess I didn't explain myself too well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First I want to select all rows with the last date;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;dt &amp;lt;&amp;lt; select where(name ("Date") == col Max(:Date));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Next I want to select only the rows with the PART ID that corresponds to the latest PART ID (id est the max date)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2016 05:21:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-select-rows-between-date-ranges/m-p/30937#M19624</guid>
      <dc:creator>steven_w_daniel</dc:creator>
      <dc:date>2016-12-01T05:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do I select rows between date ranges</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-select-rows-between-date-ranges/m-p/30939#M19626</link>
      <description>&lt;P&gt;I hope I am interpreting your question correctly.&amp;nbsp; The script below will find the row that contains the Maximum Date's Part_ID and then will select all rows that has that Part_ID value&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();

// Find the Row(s) that have the current Max Date
MaxRows = dt &amp;lt;&amp;lt; get rows where( dt:Date == Col Max( dt:Date ) );

// MaxRows is a matrix that contains all of the rows that have the
// max date.  Since your "Date" column is actually a date time 
// value that contains minutes and seconds, it is doubtful that
// more than one row will have the Max value.  However, we will
// now just get the last row from that matrix
TheRow = MaxRows[N Rows( MaxRows )];

// Now we can get the Part_ID for the row in question
TargetPartID = dt:Part_ID[TheRow];

// Now select all rows that have that Part_ID
dt &amp;lt;&amp;lt; seleect where( dt:Part_ID == TargetPartID );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Dec 2016 11:09:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-select-rows-between-date-ranges/m-p/30939#M19626</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2016-12-01T11:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do I select rows between date ranges</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-select-rows-between-date-ranges/m-p/30954#M19638</link>
      <description>&lt;P&gt;You can use Boolean expressions as the argument to the &lt;STRONG&gt;&amp;lt;&amp;lt; Select Where&lt;/STRONG&gt; message. That is, you can use the logical &lt;STRONG&gt;and&lt;/STRONG&gt;, &lt;STRONG&gt;or&lt;/STRONG&gt;, and &lt;STRONG&gt;not&lt;/STRONG&gt; functions or operators to get both the date and the product that meets both criteria. If it is a serial search, then you might have to find the last date first and use it to find the product ID.&lt;/P&gt;
&lt;P&gt;You can use the &lt;STRONG&gt;&amp;lt;&amp;lt; Get Rows Where( ... )&lt;/STRONG&gt; message to return the row numbers matching your date criterion. You can use this vector to subscript those rows from the data column to get all the part ID as a list. Then examine the list to find the one you want.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2016 15:26:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-select-rows-between-date-ranges/m-p/30954#M19638</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2016-12-01T15:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do I select rows between date ranges</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-select-rows-between-date-ranges/m-p/31067#M19674</link>
      <description>&lt;P&gt;Thanks Jim,&lt;/P&gt;&lt;P&gt;Very simple fix, Since the way the measurements are taken I have multiple parameters that have repeated max date. It worked anyway. Below is the script I came up with, however i created another logical nightmare of picking which subset table has the most recent Part ID. Your solution was much more simple.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;dt = data table ("XYZ");
// Get unique values
uVals = AssociativeArray(:Part ID &amp;lt;&amp;lt; getValues) &amp;lt;&amp;lt; getKeys;
// Make Subset Tables
for(g = 1, g &amp;lt;= NItems(uVals), g++,
 r2get = dt &amp;lt;&amp;lt; getRowsWhere(:Part ID == uVals[g]);
 dt2 = dt &amp;lt;&amp;lt; subset(Rows(r2get));
 dt2 &amp;lt;&amp;lt; setName("subset ");&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 06:09:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-select-rows-between-date-ranges/m-p/31067#M19674</guid>
      <dc:creator>steven_w_daniel</dc:creator>
      <dc:date>2016-12-02T06:09:11Z</dc:date>
    </item>
  </channel>
</rss>

