<?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: Duplicate records within multiple fields in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Duplicate-records-within-multiple-fields/m-p/2441811#M1225595</link>
    <description>&lt;P&gt;I may be overthinking it, but here is a generalized script to build a table of IDs and Fieldnames that have duplicate values within the ID.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Data:&lt;BR /&gt;LOAD * Inline [&lt;BR /&gt;ID, Fa, Fb, Fc, Fd&lt;BR /&gt;1, 34, hello, there, again&lt;BR /&gt;1, 34, is, a, duplicate&lt;BR /&gt;2, 34, not, a, duplicate&lt;BR /&gt;3, 99, 2, 3, 4&lt;BR /&gt;3, 00, 2, 3, 88&lt;BR /&gt;4, 11, 22, 33, 44&lt;BR /&gt;]&lt;BR /&gt;;&lt;BR /&gt;DupeIds:&lt;BR /&gt;Mapping&lt;BR /&gt;Load ID, Count(ID) as Count&lt;BR /&gt;Resident Data&lt;BR /&gt;Group By ID;&lt;BR /&gt;&lt;BR /&gt;For idx = 1 to NoOfFields('Data')&lt;BR /&gt;Let vFname = FieldName($(idx), 'Data');&lt;BR /&gt;If '$(vFname)' &amp;lt;&amp;gt; 'ID' Then&lt;BR /&gt;&lt;BR /&gt;  TempDistinct:&lt;BR /&gt;  // Make a Temp table instead of preceding because distinct&lt;BR /&gt;  // is applied at end of LOAD&lt;BR /&gt;  LOAD Distinct&lt;BR /&gt;    ID, [$(vFname)]&lt;BR /&gt;  Resident Data&lt;BR /&gt;  Where ApplyMap('DupeIds', ID) &amp;gt; 1&lt;BR /&gt;  ;&lt;BR /&gt;  DupeFields:&lt;BR /&gt;  Load&lt;BR /&gt;    ID, '$(vFname)' as DupeField&lt;BR /&gt;  Where Count &amp;lt; ApplyMap('DupeIds', ID)&lt;BR /&gt;  ;&lt;BR /&gt;  LOAD &lt;BR /&gt;    ID, &lt;BR /&gt;    '$(vFname)' as DupeField,&lt;BR /&gt;    Count([$(vFname)]) as Count&lt;BR /&gt;  Resident TempDistinct&lt;BR /&gt;  Group by ID&lt;BR /&gt;  ;&lt;BR /&gt;  Drop Table TempDistinct;&lt;BR /&gt;End if&lt;BR /&gt;Next idx&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;-Rob&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Apr 2024 15:51:33 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2024-04-16T15:51:33Z</dc:date>
    <item>
      <title>Duplicate records within multiple fields</title>
      <link>https://community.qlik.com/t5/QlikView/Duplicate-records-within-multiple-fields/m-p/2441621#M1225594</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I want to be able to find duplicated records within a table with around 100 fields.&lt;/P&gt;
&lt;P&gt;I have a table with over 100 fields and i have a script that finds duplicated ID's but I want to know which field is responsible for the duplication.&lt;/P&gt;
&lt;TABLE width="521"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="167"&gt;ID&lt;/TD&gt;
&lt;TD width="170"&gt;Mobile Number&lt;/TD&gt;
&lt;TD width="184"&gt;Cost&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;10045022&lt;/TD&gt;
&lt;TD&gt;07842479330&lt;/TD&gt;
&lt;TD&gt;32,100&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;10045022&lt;/TD&gt;
&lt;TD&gt;07982879541&lt;/TD&gt;
&lt;TD&gt;32,100&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example the ID is the same so as the cost but the number is different.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help ill be great.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 09:04:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Duplicate-records-within-multiple-fields/m-p/2441621#M1225594</guid>
      <dc:creator>Rayk</dc:creator>
      <dc:date>2024-04-16T09:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate records within multiple fields</title>
      <link>https://community.qlik.com/t5/QlikView/Duplicate-records-within-multiple-fields/m-p/2441811#M1225595</link>
      <description>&lt;P&gt;I may be overthinking it, but here is a generalized script to build a table of IDs and Fieldnames that have duplicate values within the ID.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Data:&lt;BR /&gt;LOAD * Inline [&lt;BR /&gt;ID, Fa, Fb, Fc, Fd&lt;BR /&gt;1, 34, hello, there, again&lt;BR /&gt;1, 34, is, a, duplicate&lt;BR /&gt;2, 34, not, a, duplicate&lt;BR /&gt;3, 99, 2, 3, 4&lt;BR /&gt;3, 00, 2, 3, 88&lt;BR /&gt;4, 11, 22, 33, 44&lt;BR /&gt;]&lt;BR /&gt;;&lt;BR /&gt;DupeIds:&lt;BR /&gt;Mapping&lt;BR /&gt;Load ID, Count(ID) as Count&lt;BR /&gt;Resident Data&lt;BR /&gt;Group By ID;&lt;BR /&gt;&lt;BR /&gt;For idx = 1 to NoOfFields('Data')&lt;BR /&gt;Let vFname = FieldName($(idx), 'Data');&lt;BR /&gt;If '$(vFname)' &amp;lt;&amp;gt; 'ID' Then&lt;BR /&gt;&lt;BR /&gt;  TempDistinct:&lt;BR /&gt;  // Make a Temp table instead of preceding because distinct&lt;BR /&gt;  // is applied at end of LOAD&lt;BR /&gt;  LOAD Distinct&lt;BR /&gt;    ID, [$(vFname)]&lt;BR /&gt;  Resident Data&lt;BR /&gt;  Where ApplyMap('DupeIds', ID) &amp;gt; 1&lt;BR /&gt;  ;&lt;BR /&gt;  DupeFields:&lt;BR /&gt;  Load&lt;BR /&gt;    ID, '$(vFname)' as DupeField&lt;BR /&gt;  Where Count &amp;lt; ApplyMap('DupeIds', ID)&lt;BR /&gt;  ;&lt;BR /&gt;  LOAD &lt;BR /&gt;    ID, &lt;BR /&gt;    '$(vFname)' as DupeField,&lt;BR /&gt;    Count([$(vFname)]) as Count&lt;BR /&gt;  Resident TempDistinct&lt;BR /&gt;  Group by ID&lt;BR /&gt;  ;&lt;BR /&gt;  Drop Table TempDistinct;&lt;BR /&gt;End if&lt;BR /&gt;Next idx&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;-Rob&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 15:51:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Duplicate-records-within-multiple-fields/m-p/2441811#M1225595</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2024-04-16T15:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate records within multiple fields</title>
      <link>https://community.qlik.com/t5/QlikView/Duplicate-records-within-multiple-fields/m-p/2442084#M1225597</link>
      <description>&lt;P&gt;Hi Rwunderlich,&lt;/P&gt;
&lt;P&gt;It worked with a bit of of tweak, but I already have a table with a duplicated IDs and this table tells me which table it is in, but I need to do your script for each table in the list.&lt;/P&gt;
&lt;P&gt;here is an example of the table:&lt;/P&gt;
&lt;TABLE width="319"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="98"&gt;Error&lt;/TD&gt;
&lt;TD width="157"&gt;,PrimaryKeyID&lt;/TD&gt;
&lt;TD width="64"&gt;,Table&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;PK Duplication&lt;/TD&gt;
&lt;TD&gt;,10045022&lt;/TD&gt;
&lt;TD&gt;,Order&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;PK Duplication&lt;/TD&gt;
&lt;TD&gt;,10045037&lt;/TD&gt;
&lt;TD&gt;,Order&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;PK Duplication&lt;/TD&gt;
&lt;TD&gt;,10046679&lt;/TD&gt;
&lt;TD&gt;,Order&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;PK Duplication&lt;/TD&gt;
&lt;TD&gt;,ML_10036414/10109581&lt;/TD&gt;
&lt;TD&gt;,Order&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;PK Duplication&lt;/TD&gt;
&lt;TD&gt;,ML_10037063/10111962&lt;/TD&gt;
&lt;TD&gt;,Order&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;PK Duplication&lt;/TD&gt;
&lt;TD&gt;,ML_10038116/10114074&lt;/TD&gt;
&lt;TD&gt;,MasterListCSVprovisional&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;PK Duplication&lt;/TD&gt;
&lt;TD&gt;,ML_10053793/10139362&lt;/TD&gt;
&lt;TD&gt;,Driver&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;PK Duplication&lt;/TD&gt;
&lt;TD&gt;,ML_10053793/10139437&lt;/TD&gt;
&lt;TD&gt;,Driver&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;PK Duplication&lt;/TD&gt;
&lt;TD&gt;,ML_10053793/10142502&lt;/TD&gt;
&lt;TD&gt;,Driver&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;PK Duplication&lt;/TD&gt;
&lt;TD&gt;,ML_10111446/10111962&lt;/TD&gt;
&lt;TD&gt;,Driver&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;PK Duplication&lt;/TD&gt;
&lt;TD&gt;,ML_10111446/10114074&lt;/TD&gt;
&lt;TD&gt;,Driver&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;PK Duplication&lt;/TD&gt;
&lt;TD&gt;,ML_10139640/10109581&lt;/TD&gt;
&lt;TD&gt;,Driver&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;PK Duplication&lt;/TD&gt;
&lt;TD&gt;,ML_10139640/10113870&lt;/TD&gt;
&lt;TD&gt;,Driver&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;PK Duplication&lt;/TD&gt;
&lt;TD&gt;,ML_10139640/10113875&lt;/TD&gt;
&lt;TD&gt;,Driver&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, for each table in the field table I want it to do your script.&lt;/P&gt;
&lt;P&gt;Hope this make sense.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2024 12:06:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Duplicate-records-within-multiple-fields/m-p/2442084#M1225597</guid>
      <dc:creator>Rayk</dc:creator>
      <dc:date>2024-04-17T12:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate records within multiple fields</title>
      <link>https://community.qlik.com/t5/QlikView/Duplicate-records-within-multiple-fields/m-p/2443098#M1225608</link>
      <description>&lt;P&gt;So you'll just load from the Resident variable table name instead of Resident Data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can loop over the TableNames from in your dupes table like this:&lt;/P&gt;
&lt;PRE&gt;For i = 1 to FieldValueCount('TableName')&lt;BR /&gt;Let vTableName = FieldValue('TableName', $(i);&lt;BR /&gt;&lt;BR /&gt;// The field processing loop here using&amp;nbsp;&lt;BR /&gt;Resident [$(vTableName)];&lt;BR /&gt;&lt;BR /&gt;Next i&lt;/PRE&gt;
&lt;P&gt;-Rob&lt;/P&gt;</description>
      <pubDate>Fri, 19 Apr 2024 18:01:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Duplicate-records-within-multiple-fields/m-p/2443098#M1225608</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2024-04-19T18:01:26Z</dc:date>
    </item>
  </channel>
</rss>

