<?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: Loop for duplicates search QlikView in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Loop-for-duplicates-search-QlikView/m-p/111001#M602023</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think your code may be more complex than necessary.&amp;nbsp; If you wanted to keep only the highest ID for duplicates and delete others:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Inner Join (Report4_RiskFactors)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LOAD max(R4Factor_Id) as R4Factor_Id&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Resident &lt;SPAN style="font-size: 13.3333px;"&gt;Report4_RiskFactors&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'courier new', courier;"&gt;Group By R4Factor_RiskFactorName, R4Factor_BusinessDirectionName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;If you want to collect the max ids instead of deleting rows, remove the Inner Join. &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://masterssummit.com/" rel="nofollow" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://qlikviewcookbook.com/" rel="nofollow" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://www.easyqlik.com/" rel="nofollow" target="_blank"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Aug 2018 04:42:36 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2018-08-07T04:42:36Z</dc:date>
    <item>
      <title>Loop for duplicates search QlikView</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-for-duplicates-search-QlikView/m-p/111000#M602022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an interesting problem to solve. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So we have uploaded a database to QlikView, a database which has had such an issue that every time a user uploads new data entry, instead of rewriting the row with the same ID, it creates a new one with unique ID. The approach I have chosen is the loop inside the script that checks whether the two descriptions (in two columns) are equal, if yes - the script marks the ID as max, this way, every time the entry has matching descriptions, it chooses the one with the maximum ID. The loop seems to be okay but the problem is with the max attribution. Can anyone please have a look and comment on what might be changed? Would be glad for any help. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bit of script is below. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;EM&gt;LOAD R4Factor_ReportId, R4Factor_Id, R4Factor_General_EvalVolume, R4Factor_General_EvalMoney, &lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; R4Factor_General_FreqPerYear, R4Factor_General_EvalVolume_Ost, R4Factor_General_EvalMoney_Ost, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; R4Factor_General_FreqPerYear_Ost, R4Factor_DamageQuarterVolume, R4Factor_DamageYearVolume, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; R4Factor_DamageQuarterMoney, R4Factor_DamageYearMoney, R4Factor_WeightRisk, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; R4Factor_WeightArea, R4Factor_UpperLimitOfDamageQuarter, R4Factor_UpperLimitOfDamageYear, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; R4Factor_RiskFactorName, R4Factor_BusinessDirectionName&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt;FROM QVD\Report4_RiskFactors.qvd (qvd);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt;Report4_RiskFactors:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt;SET i = 1; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt;LET n = NoOfRows('Report4_RiskFactors');&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt;DO while $(i) &amp;lt;= $(n)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt; SET j = 1;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt; LET max = 0;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt; DO while $(j) &amp;lt;= $(n)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt; LOAD Peek('R4Factor_RiskFactorName',$(i),'Report4_RiskFactors') as RiskName1;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt; LOAD Peek('R4Factor_RiskFactorName',$(j),'Report4_RiskFactors') as RiskName2;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt; LOAD Peek('R4Factor_BusinessDirectionName',$(i),'Report4_RiskFactors') as RiskBusinessDir1;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt; LOAD Peek('R4Factor_BusinessDirectionName',$(j),'Report4_RiskFactors') as RiskBusinessDir2;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt; LOAD Peek('R4Factor_Id',$(i),'Report4_RiskFactors') as RiskID1;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt; LOAD Peek('R4Factor_Id',$(j),'Report4_RiskFactors') as RiskID2;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt; if ((RiskName1 = RiskName2) and (RiskBusinessDir1 = RiskBusinessDir2))THEN&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt; if (RiskID1 &amp;gt; RiskID2) THEN LET max = $(RiskID1); //as r4Factor_Id&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt; elseif (RiskID2 &amp;gt; $(max)) THEN ($(max) = RiskID2);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt; end if&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt; end if&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt; $(j) = $(j)+1;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt; LOOP&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt; r4factor_Id_table:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt; LOAD $(max) as r4Factor_Id;&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 13.3333px;"&gt; $(i) = $(i)+1;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;EM&gt;LOOP&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2018 03:34:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-for-duplicates-search-QlikView/m-p/111000#M602022</guid>
      <dc:creator>zyevniyeva</dc:creator>
      <dc:date>2018-08-07T03:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: Loop for duplicates search QlikView</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-for-duplicates-search-QlikView/m-p/111001#M602023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think your code may be more complex than necessary.&amp;nbsp; If you wanted to keep only the highest ID for duplicates and delete others:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Inner Join (Report4_RiskFactors)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LOAD max(R4Factor_Id) as R4Factor_Id&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Resident &lt;SPAN style="font-size: 13.3333px;"&gt;Report4_RiskFactors&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'courier new', courier;"&gt;Group By R4Factor_RiskFactorName, R4Factor_BusinessDirectionName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;If you want to collect the max ids instead of deleting rows, remove the Inner Join. &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://masterssummit.com/" rel="nofollow" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://qlikviewcookbook.com/" rel="nofollow" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://www.easyqlik.com/" rel="nofollow" target="_blank"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2018 04:42:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-for-duplicates-search-QlikView/m-p/111001#M602023</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2018-08-07T04:42:36Z</dc:date>
    </item>
  </channel>
</rss>

