<?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 Re: Remove Duplicate rows using Timestamp in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Remove-Duplicate-rows-using-Timestamp/m-p/427494#M67703</link>
    <description>&lt;P&gt;Hello Ron,&lt;/P&gt;&lt;P&gt;I tried your solution and I see an issue with the result.&lt;/P&gt;&lt;P&gt;I have attached the result from running your code. It seems like it is not catching a couple of duplicate entries for some reason.&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 17 Oct 2021 20:02:45 GMT</pubDate>
    <dc:creator>psundar6</dc:creator>
    <dc:date>2021-10-17T20:02:45Z</dc:date>
    <item>
      <title>Remove Duplicate rows using Timestamp</title>
      <link>https://community.jmp.com/t5/Discussions/Remove-Duplicate-rows-using-Timestamp/m-p/427439#M67698</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a sample data table attached wherein I am looking to remove duplicate rows within the data set using the TimeStamp,Tool columns.&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Criteria for duplication:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;Timestamp that are within 6mins on the same tool are considered as duplicates and those rows have to be removed.&lt;/P&gt;&lt;P&gt;Can someone help how this can be achieved in JSL?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:38:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Remove-Duplicate-rows-using-Timestamp/m-p/427439#M67698</guid>
      <dc:creator>psundar6</dc:creator>
      <dc:date>2023-06-10T23:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Duplicate rows using Timestamp</title>
      <link>https://community.jmp.com/t5/Discussions/Remove-Duplicate-rows-using-Timestamp/m-p/427446#M67699</link>
      <description>&lt;P&gt;I believe this will give you an example on how to proceed with your issue&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();

// Loop through the data table deleting all duplicate rows
i = 1;
While( i &amp;lt;= N Rows( dt ),
	
	// Find the upper and lower bounds to match on
	lower = :timeStamp[i] - In Minutes( 6 );
	upper = :timeStamp[i] + In Minutes( 6 );
	
	// Find the rows that match
	theRows = dt &amp;lt;&amp;lt; get rows where( :timeStamp &amp;gt; lower &amp;amp; :timeStamp &amp;lt; upper );
	
	// Remove the current row from the list.  We do not want to delete it
	Try( theRows[1] = [] );
	
	// Delete the remaining rows
	Try( dt &amp;lt;&amp;lt; delete rows( theRows ) );
	
	// Increment the row to work on
	i++;
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 17 Oct 2021 04:53:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Remove-Duplicate-rows-using-Timestamp/m-p/427446#M67699</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-10-17T04:53:47Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Duplicate rows using Timestamp</title>
      <link>https://community.jmp.com/t5/Discussions/Remove-Duplicate-rows-using-Timestamp/m-p/427460#M67700</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14978"&gt;@psundar6&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt; provides a very good solution.&lt;/P&gt;
&lt;P&gt;An alternative approach using table sort and column formula could be done interactively or by scripting as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = current data table();

dt &amp;lt;&amp;lt; Sort(
	By( :TimeStamp, :Tool ),
	Replace Table,
	Order( Ascending, Ascending )
);

dt &amp;lt;&amp;lt; New Column( "to delete",
	Numeric,
	"Ordinal",
	Format( "Best", 12 ),
	Formula( If( :Tool == Lag( :Tool, 1 ) &amp;amp; Date Difference( Lag( :TimeStamp, 1 ), :TimeStamp, "Minute" ) &amp;lt; 6, 1, 0 ), eval formula )
);
dt:to delete &amp;lt;&amp;lt; suppress eval(true);

dt&amp;lt;&amp;lt; delete rows (dt&amp;lt;&amp;lt; get rows where (:to delete == 1));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;let us know if it works for you.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Oct 2021 22:49:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Remove-Duplicate-rows-using-Timestamp/m-p/427460#M67700</guid>
      <dc:creator>ron_horne</dc:creator>
      <dc:date>2021-10-17T22:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Duplicate rows using Timestamp</title>
      <link>https://community.jmp.com/t5/Discussions/Remove-Duplicate-rows-using-Timestamp/m-p/427494#M67703</link>
      <description>&lt;P&gt;Hello Ron,&lt;/P&gt;&lt;P&gt;I tried your solution and I see an issue with the result.&lt;/P&gt;&lt;P&gt;I have attached the result from running your code. It seems like it is not catching a couple of duplicate entries for some reason.&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Oct 2021 20:02:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Remove-Duplicate-rows-using-Timestamp/m-p/427494#M67703</guid>
      <dc:creator>psundar6</dc:creator>
      <dc:date>2021-10-17T20:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Duplicate rows using Timestamp</title>
      <link>https://community.jmp.com/t5/Discussions/Remove-Duplicate-rows-using-Timestamp/m-p/427495#M67704</link>
      <description>&lt;P&gt;This works, Thank you!&lt;/P&gt;</description>
      <pubDate>Sun, 17 Oct 2021 20:03:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Remove-Duplicate-rows-using-Timestamp/m-p/427495#M67704</guid>
      <dc:creator>psundar6</dc:creator>
      <dc:date>2021-10-17T20:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Duplicate rows using Timestamp</title>
      <link>https://community.jmp.com/t5/Discussions/Remove-Duplicate-rows-using-Timestamp/m-p/427515#M67705</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14978"&gt;@psundar6&lt;/a&gt;&amp;nbsp;for letting me know. there was a typo now I have edited the script..&lt;/P&gt;</description>
      <pubDate>Sun, 17 Oct 2021 22:52:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Remove-Duplicate-rows-using-Timestamp/m-p/427515#M67705</guid>
      <dc:creator>ron_horne</dc:creator>
      <dc:date>2021-10-17T22:52:21Z</dc:date>
    </item>
  </channel>
</rss>

