<?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: Script for removing duplicate rows in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Script-for-removing-duplicate-rows/m-p/431003#M68070</link>
    <description>&lt;P&gt;JMPs interactive Select Dublicate Rows with Delete Rows should be able to do this.&lt;/P&gt;&lt;P&gt;Select columns of interest:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1635417088099.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/37070i880743ABDF82AA0B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1635417088099.png" alt="jthi_0-1635417088099.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Go to Rows / Row Selection / Select Dublicate Rows:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1635417113039.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/37071i3453FDA7D36BD528/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1635417113039.png" alt="jthi_1-1635417113039.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Right click on row number and Delete Rows:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_2-1635417132091.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/37072iB5EB75679472859B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_2-1635417132091.png" alt="jthi_2-1635417132091.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If you have JMP16 repeat same steps while you have Enhanced log enabled, it will return you the script:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;// Delete selected rows
Data Table("Untitled") &amp;lt;&amp;lt; Select Duplicate Rows(Match(:Date, :A, :B)) &amp;lt;&amp;lt; Delete Rows;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;(update the script to use references).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Oct 2021 10:33:52 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2021-10-28T10:33:52Z</dc:date>
    <item>
      <title>Script for removing duplicate rows</title>
      <link>https://community.jmp.com/t5/Discussions/Script-for-removing-duplicate-rows/m-p/430981#M68069</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a script where I update a table by another one.&lt;/P&gt;&lt;P&gt;For the final table, I would like to remove duplicate rows based on defined columns.&lt;/P&gt;&lt;P&gt;Thereby, the row with the lower row number should be deleted.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the following you can see an example for better illustration:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Row&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;A&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;B&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;C&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;D&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;22.10.2021&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;23.10.2021&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;27&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;26.10.2021&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;25.10.2021&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;5&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;26.10.2021&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For this table, the duplicate rows are defined by the columns :Date, :A and :B.&lt;/P&gt;&lt;P&gt;Row 3 should be deleted and row 5 kept.&lt;/P&gt;&lt;P&gt;Could you provide me with a JSL code for that example?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Konstantinos&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 18:04:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-for-removing-duplicate-rows/m-p/430981#M68069</guid>
      <dc:creator>Konstantinos</dc:creator>
      <dc:date>2023-06-09T18:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: Script for removing duplicate rows</title>
      <link>https://community.jmp.com/t5/Discussions/Script-for-removing-duplicate-rows/m-p/431003#M68070</link>
      <description>&lt;P&gt;JMPs interactive Select Dublicate Rows with Delete Rows should be able to do this.&lt;/P&gt;&lt;P&gt;Select columns of interest:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1635417088099.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/37070i880743ABDF82AA0B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1635417088099.png" alt="jthi_0-1635417088099.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Go to Rows / Row Selection / Select Dublicate Rows:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1635417113039.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/37071i3453FDA7D36BD528/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1635417113039.png" alt="jthi_1-1635417113039.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Right click on row number and Delete Rows:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_2-1635417132091.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/37072iB5EB75679472859B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_2-1635417132091.png" alt="jthi_2-1635417132091.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If you have JMP16 repeat same steps while you have Enhanced log enabled, it will return you the script:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;// Delete selected rows
Data Table("Untitled") &amp;lt;&amp;lt; Select Duplicate Rows(Match(:Date, :A, :B)) &amp;lt;&amp;lt; Delete Rows;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;(update the script to use references).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Oct 2021 10:33:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-for-removing-duplicate-rows/m-p/431003#M68070</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-10-28T10:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: Script for removing duplicate rows</title>
      <link>https://community.jmp.com/t5/Discussions/Script-for-removing-duplicate-rows/m-p/431004#M68071</link>
      <description>&lt;P&gt;Thanks for your prompt reply. Unfortunately, that does not fulfill my requirement. I want that row 3 is deleted and not row 5.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Oct 2021 10:47:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-for-removing-duplicate-rows/m-p/431004#M68071</guid>
      <dc:creator>Konstantinos</dc:creator>
      <dc:date>2021-10-28T10:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: Script for removing duplicate rows</title>
      <link>https://community.jmp.com/t5/Discussions/Script-for-removing-duplicate-rows/m-p/431005#M68072</link>
      <description>&lt;P&gt;One option would be to sort the data first by Row number -&amp;gt; delete duplicates and then sort again.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Oct 2021 11:26:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-for-removing-duplicate-rows/m-p/431005#M68072</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-10-28T11:26:15Z</dc:date>
    </item>
    <item>
      <title>Re: Script for removing duplicate rows</title>
      <link>https://community.jmp.com/t5/Discussions/Script-for-removing-duplicate-rows/m-p/431006#M68073</link>
      <description>&lt;P&gt;You could also create formula to count unique values. Something like this might work:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Col Number(:Date, :A, :B) - Col Cumulative Sum(1, :Date, :A, :B)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Select all 0 values and invert selection. Then delete rows.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Oct 2021 11:30:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-for-removing-duplicate-rows/m-p/431006#M68073</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-10-28T11:30:07Z</dc:date>
    </item>
  </channel>
</rss>

