<?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 Deleting Similar Rows in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Deleting-Similar-Rows/m-p/765934#M94577</link>
    <description>&lt;DIV&gt;I'm trying to create a script that will delete a row from my table if the ID and two values are the same as the row before it. I cant delete all duplicate rows because there is a "run number" column that is unique to each row. Does anyone know why my code isn't working?&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Delete Duplicate Rows (re-entries)
NRows = N Rows(dt);
For(i = 1, i &amp;lt;= NRows, i++,
	If(
		dt:ID[i] == dt:ID[i + 1] &amp;amp; Data Table("Sheet1"):value1[i] == dt:value1[i + 1] &amp;amp; dt
		:value2[i] == dt:value2[i + 1],
		{dt &amp;lt;&amp;lt; Delete Rows(i), i--}
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="S_Boilermaker_0-1718371290032.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/65222i522FC691537F405D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="S_Boilermaker_0-1718371290032.png" alt="S_Boilermaker_0-1718371290032.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;</description>
    <pubDate>Fri, 14 Jun 2024 16:52:29 GMT</pubDate>
    <dc:creator>S_Boilermaker</dc:creator>
    <dc:date>2024-06-14T16:52:29Z</dc:date>
    <item>
      <title>Deleting Similar Rows</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-Similar-Rows/m-p/765934#M94577</link>
      <description>&lt;DIV&gt;I'm trying to create a script that will delete a row from my table if the ID and two values are the same as the row before it. I cant delete all duplicate rows because there is a "run number" column that is unique to each row. Does anyone know why my code isn't working?&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Delete Duplicate Rows (re-entries)
NRows = N Rows(dt);
For(i = 1, i &amp;lt;= NRows, i++,
	If(
		dt:ID[i] == dt:ID[i + 1] &amp;amp; Data Table("Sheet1"):value1[i] == dt:value1[i + 1] &amp;amp; dt
		:value2[i] == dt:value2[i + 1],
		{dt &amp;lt;&amp;lt; Delete Rows(i), i--}
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="S_Boilermaker_0-1718371290032.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/65222i522FC691537F405D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="S_Boilermaker_0-1718371290032.png" alt="S_Boilermaker_0-1718371290032.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 14 Jun 2024 16:52:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-Similar-Rows/m-p/765934#M94577</guid>
      <dc:creator>S_Boilermaker</dc:creator>
      <dc:date>2024-06-14T16:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Similar Rows</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-Similar-Rows/m-p/765966#M94584</link>
      <description>&lt;P&gt;I think this portion of your script in the braces is where things are going wrong (the if() function doesn't generally want braces there):&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;{ dt &amp;lt;&amp;lt; Delete Rows (i), i --}&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That being said, here's another, perhaps simpler way to get what you want, using JMP's built-in function for selecting duplicates:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; Select Duplicate Rows ({:ID, :Value 1, :Value 2});
dt &amp;lt;&amp;lt; delete rows;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Jun 2024 14:49:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-Similar-Rows/m-p/765966#M94584</guid>
      <dc:creator>Jed_Campbell</dc:creator>
      <dc:date>2024-06-14T14:49:40Z</dc:date>
    </item>
  </channel>
</rss>

