<?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: Do I use a loop for this? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077159#M645151</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gijsbert,&lt;/P&gt;&lt;P&gt;That's not what I want.&lt;/P&gt;&lt;P&gt;Let's suppose that one %Id has ten records, each with a different sequence_nr.&lt;/P&gt;&lt;P&gt;- if ONE of those contains type 'L', (sequence_nr not important) then I just want THAT record. The rest must be discarded.&lt;/P&gt;&lt;P&gt;- if NONE of those contains type 'L', but ONE of those contains type 'O', then I just want THAT record - the rest must be discarded.&lt;/P&gt;&lt;P&gt;- if NONE of those contains either 'L' or 'O', but one contains type 'P', then I just want THAT one - the rest must be discarded.&lt;/P&gt;&lt;P&gt;- if NONE of those contains either 'L' or 'O' or 'P', but one contains type 'W' then I just want THAT one - the rest must be discarded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So: If you have one %Id for ten records, and they ALL have 'P', then I only want one, prefereably the one with the lowest sequence_nr.&lt;/P&gt;&lt;P&gt;If there is ONE type record for an %Id, then there is no need for testing: I just want that one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this clears my problem. The L-O-P-W order is leading. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Jan 2016 07:05:24 GMT</pubDate>
    <dc:creator>hansdevr</dc:creator>
    <dc:date>2016-01-14T07:05:24Z</dc:date>
    <item>
      <title>Do I use a loop for this?</title>
      <link>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077152#M645144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have two tables:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Tables.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/111448_Tables.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;Of course, this is a simpified version of the original.&lt;/P&gt;&lt;P&gt;I have (inner) joined these tables to one new table, with the following contence:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Contence.PNG" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/111449_Contence.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;For my project I have to 'distill' a new table from this one. as you can see, the Sequence_nr determines the number of times the %Id appears in the table. In my new table, there would be only one unique value for %Id. Second: the contence of 'Type' is very relevant. It can only be 'L', 'O',&amp;nbsp; 'P' of 'W', in the same order of importance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One %Id can have any number of sequence numbers, but when type 'L' is present in one of those, the resulting record would only contain the source record of type 'L'. All other records should be discarded. If no 'L' is present and an 'O' record is present, the resulting unique record should be the one that originally contained the 'O' - again the rest should be discarded, etcetera. Of course, if only 1 Sequence_nr was present, no records are discarded.&lt;/P&gt;&lt;P&gt;Which should result in the following table:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Result.PNG" class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/111450_Result.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;What would be the correct (and preferably fastest) way of achieving this? Should I use a loop on my concatenated table? And if yes, how? I am sure this would be an interesting case for anyone who wishes to create a table containing only unique values, determined by a value in one of the original tables...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jan 2016 08:22:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077152#M645144</guid>
      <dc:creator>hansdevr</dc:creator>
      <dc:date>2016-01-13T08:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: Do I use a loop for this?</title>
      <link>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077153#M645145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So you want to join only the records with sequence_nr 1. Try this then:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MyTable:&lt;/P&gt;&lt;P&gt;LOAD *&lt;/P&gt;&lt;P&gt;FROM [Table 1];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;JOIN (MyTable)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD *&lt;/P&gt;&lt;P&gt;FROM [Table 2]&lt;/P&gt;&lt;P&gt;WHERE Sequence_nr =1;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jan 2016 18:37:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077153#M645145</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-01-13T18:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: Do I use a loop for this?</title>
      <link>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077154#M645146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;guessing Type doesn't have to appear in Table2 in your preferred order, one solution might be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QlikCommunity_Thread_199320_Pic1.JPG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/111561_QlikCommunity_Thread_199320_Pic1.JPG" style="height: auto; width: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14527241500634519 jive_text_macro" jivemacro_uid="_14527241500634519"&gt;
&lt;P&gt;Table1:&lt;/P&gt;
&lt;P&gt;LOAD * Inline [&lt;/P&gt;
&lt;P&gt;%Id, Incident_year&lt;/P&gt;
&lt;P&gt;90010100, 2015&lt;/P&gt;
&lt;P&gt;90010102, 2015&lt;/P&gt;
&lt;P&gt;90010103, 2015&lt;/P&gt;
&lt;P&gt;90010107, 2015&lt;/P&gt;
&lt;P&gt;90010109, 2015&lt;/P&gt;
&lt;P&gt;90010110, 2015&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Table2:&lt;/P&gt;
&lt;P&gt;LOAD * Inline [&lt;/P&gt;
&lt;P&gt;%Id, Sequence_nr, Type, Category&lt;/P&gt;
&lt;P&gt;90010100, 1, L, A&lt;/P&gt;
&lt;P&gt;90010100, 2, P, A&lt;/P&gt;
&lt;P&gt;90010102, 1, P, A&lt;/P&gt;
&lt;P&gt;90010103, 1, P, B&lt;/P&gt;
&lt;P&gt;90010103, 2, W, B&lt;/P&gt;
&lt;P&gt;90010107, 1, O, C&lt;/P&gt;
&lt;P&gt;90010109, 1, O, A&lt;/P&gt;
&lt;P&gt;90010109, 2, P, A&lt;/P&gt;
&lt;P&gt;90010110, 1, W, D&lt;/P&gt;
&lt;P&gt;90010110, 2, O, D&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;NoConcatenate&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;TabResult:&lt;/P&gt;
&lt;P&gt;LOAD * Resident Table1;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Join (TabResult)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;LOAD %Id,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Pick(WildMatch(Concat(Type,'|'),'*L*','*O*','*P*','*W*'),'L','O','P','W') as Type,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Only(Category) as Category&lt;/P&gt;
&lt;P&gt;Resident Table2&lt;/P&gt;
&lt;P&gt;Group By %Id;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;DROP Tables Table1, Table2;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jan 2016 22:29:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077154#M645146</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2016-01-13T22:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: Do I use a loop for this?</title>
      <link>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077155#M645147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;or maybe like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QlikCommunity_Thread_199320_Pic2.JPG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/111563_QlikCommunity_Thread_199320_Pic2.JPG" style="max-width: 620px; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14527250942195576 jive_text_macro" jivemacro_uid="_14527250942195576"&gt;
&lt;P&gt;TabType:&lt;/P&gt;
&lt;P&gt;LOAD * Inline [&lt;/P&gt;
&lt;P&gt;Type&lt;/P&gt;
&lt;P&gt;L&lt;/P&gt;
&lt;P&gt;O&lt;/P&gt;
&lt;P&gt;P&lt;/P&gt;
&lt;P&gt;W&lt;/P&gt;
&lt;P&gt;C&lt;/P&gt;
&lt;P&gt;F&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Table1:&lt;/P&gt;
&lt;P&gt;LOAD * Inline [&lt;/P&gt;
&lt;P&gt;%Id, Incident_year&lt;/P&gt;
&lt;P&gt;90010100, 2015&lt;/P&gt;
&lt;P&gt;90010102, 2015&lt;/P&gt;
&lt;P&gt;90010103, 2015&lt;/P&gt;
&lt;P&gt;90010107, 2015&lt;/P&gt;
&lt;P&gt;90010109, 2015&lt;/P&gt;
&lt;P&gt;90010110, 2015&lt;/P&gt;
&lt;P&gt;90010111, 2015&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Table2:&lt;/P&gt;
&lt;P&gt;LOAD * Inline [&lt;/P&gt;
&lt;P&gt;%Id, Sequence_nr, Type, Category&lt;/P&gt;
&lt;P&gt;90010100, 1, L, A&lt;/P&gt;
&lt;P&gt;90010100, 2, P, A&lt;/P&gt;
&lt;P&gt;90010102, 1, P, A&lt;/P&gt;
&lt;P&gt;90010103, 1, P, B&lt;/P&gt;
&lt;P&gt;90010103, 2, W, B&lt;/P&gt;
&lt;P&gt;90010107, 1, O, C&lt;/P&gt;
&lt;P&gt;90010109, 1, O, A&lt;/P&gt;
&lt;P&gt;90010109, 2, P, A&lt;/P&gt;
&lt;P&gt;90010110, 1, W, D&lt;/P&gt;
&lt;P&gt;90010110, 2, O, D&lt;/P&gt;
&lt;P&gt;90010111, 1, F, H&lt;/P&gt;
&lt;P&gt;90010111, 2, C, H&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;NoConcatenate&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;TabResult:&lt;/P&gt;
&lt;P&gt;LOAD * Resident Table1;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Join (TabResult)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;LOAD %Id,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FirstSortedValue(Type,FieldIndex('Type',Type)) as Type,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Only(Category) as Category&lt;/P&gt;
&lt;P&gt;Resident Table2&lt;/P&gt;
&lt;P&gt;Group By %Id;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;DROP Tables Table1, Table2, TabType;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jan 2016 22:47:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077155#M645147</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2016-01-13T22:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: Do I use a loop for this?</title>
      <link>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077156#M645148</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;another one:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14527257923101901" jivemacro_uid="_14527257923101901"&gt;
&lt;P&gt;TabType:&lt;/P&gt;
&lt;P&gt;LOAD AutoNumber(Type,'Type') Inline [&lt;/P&gt;
&lt;P&gt;Type&lt;/P&gt;
&lt;P&gt;L&lt;/P&gt;
&lt;P&gt;O&lt;/P&gt;
&lt;P&gt;P&lt;/P&gt;
&lt;P&gt;W&lt;/P&gt;
&lt;P&gt;C&lt;/P&gt;
&lt;P&gt;F&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Table1:&lt;/P&gt;
&lt;P&gt;LOAD * Inline [&lt;/P&gt;
&lt;P&gt;%Id, Incident_year&lt;/P&gt;
&lt;P&gt;90010100, 2015&lt;/P&gt;
&lt;P&gt;90010102, 2015&lt;/P&gt;
&lt;P&gt;90010103, 2015&lt;/P&gt;
&lt;P&gt;90010107, 2015&lt;/P&gt;
&lt;P&gt;90010109, 2015&lt;/P&gt;
&lt;P&gt;90010110, 2015&lt;/P&gt;
&lt;P&gt;90010111, 2015&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Table2:&lt;/P&gt;
&lt;P&gt;LOAD * Inline [&lt;/P&gt;
&lt;P&gt;%Id, Sequence_nr, Type, Category&lt;/P&gt;
&lt;P&gt;90010100, 1, L, A&lt;/P&gt;
&lt;P&gt;90010100, 2, P, A&lt;/P&gt;
&lt;P&gt;90010102, 1, P, A&lt;/P&gt;
&lt;P&gt;90010103, 1, P, B&lt;/P&gt;
&lt;P&gt;90010103, 2, W, B&lt;/P&gt;
&lt;P&gt;90010107, 1, O, C&lt;/P&gt;
&lt;P&gt;90010109, 1, O, A&lt;/P&gt;
&lt;P&gt;90010109, 2, P, A&lt;/P&gt;
&lt;P&gt;90010110, 1, W, D&lt;/P&gt;
&lt;P&gt;90010110, 2, O, D&lt;/P&gt;
&lt;P&gt;90010111, 1, F, H&lt;/P&gt;
&lt;P&gt;90010111, 2, C, H&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;NoConcatenate&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;TabResult:&lt;/P&gt;
&lt;P&gt;LOAD * Resident Table1;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Join (TabResult)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;LOAD %Id,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FirstSortedValue(Type,AutoNumber(Type,'Type')) as Type,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Only(Category) as Category&lt;/P&gt;
&lt;P&gt;Resident Table2&lt;/P&gt;
&lt;P&gt;Group By %Id;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;DROP Tables Table1, Table2, TabType;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jan 2016 22:57:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077156#M645148</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2016-01-13T22:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: Do I use a loop for this?</title>
      <link>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077157#M645149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14527260065692367" jivemacro_uid="_14527260065692367"&gt;
&lt;P&gt;MapType:&lt;/P&gt;
&lt;P&gt;Mapping LOAD *,RecNo() Inline [&lt;/P&gt;
&lt;P&gt;Type&lt;/P&gt;
&lt;P&gt;L&lt;/P&gt;
&lt;P&gt;O&lt;/P&gt;
&lt;P&gt;P&lt;/P&gt;
&lt;P&gt;W&lt;/P&gt;
&lt;P&gt;C&lt;/P&gt;
&lt;P&gt;F&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Table1:&lt;/P&gt;
&lt;P&gt;LOAD * Inline [&lt;/P&gt;
&lt;P&gt;%Id, Incident_year&lt;/P&gt;
&lt;P&gt;90010100, 2015&lt;/P&gt;
&lt;P&gt;90010102, 2015&lt;/P&gt;
&lt;P&gt;90010103, 2015&lt;/P&gt;
&lt;P&gt;90010107, 2015&lt;/P&gt;
&lt;P&gt;90010109, 2015&lt;/P&gt;
&lt;P&gt;90010110, 2015&lt;/P&gt;
&lt;P&gt;90010111, 2015&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Table2:&lt;/P&gt;
&lt;P&gt;LOAD * Inline [&lt;/P&gt;
&lt;P&gt;%Id, Sequence_nr, Type, Category&lt;/P&gt;
&lt;P&gt;90010100, 1, L, A&lt;/P&gt;
&lt;P&gt;90010100, 2, P, A&lt;/P&gt;
&lt;P&gt;90010102, 1, P, A&lt;/P&gt;
&lt;P&gt;90010103, 1, P, B&lt;/P&gt;
&lt;P&gt;90010103, 2, W, B&lt;/P&gt;
&lt;P&gt;90010107, 1, O, C&lt;/P&gt;
&lt;P&gt;90010109, 1, O, A&lt;/P&gt;
&lt;P&gt;90010109, 2, P, A&lt;/P&gt;
&lt;P&gt;90010110, 1, W, D&lt;/P&gt;
&lt;P&gt;90010110, 2, O, D&lt;/P&gt;
&lt;P&gt;90010111, 1, F, H&lt;/P&gt;
&lt;P&gt;90010111, 2, C, H&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;NoConcatenate&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;TabResult:&lt;/P&gt;
&lt;P&gt;LOAD * Resident Table1;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Join (TabResult)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;LOAD %Id,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FirstSortedValue(Type,ApplyMap('MapType',Type)) as Type,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Only(Category) as Category&lt;/P&gt;
&lt;P&gt;Resident Table2&lt;/P&gt;
&lt;P&gt;Group By %Id;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;DROP Tables Table1, Table2;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jan 2016 23:00:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077157#M645149</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2016-01-13T23:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: Do I use a loop for this?</title>
      <link>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077158#M645150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The fastest way of doing this is by just making a chart in your UI without creating a new table. A chart can make exactly what you need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can create a straight table with:&lt;/P&gt;&lt;P&gt;1) Two dimensions: %Id, Incident_year&lt;/P&gt;&lt;P&gt;2) Two expressions: &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Chr( Min( Ord( Type ) ) )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Only( Category )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you absolutely need or want to HAVE a new table in your load script you could create it like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14527270488565563 jive_text_macro" jivemacro_uid="_14527270488565563"&gt;
&lt;P&gt;DATA2:&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;&amp;nbsp; %Id AS %Id_,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Incident_year AS Incident_year_,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Chr( Min( Ord( Type ) ) ) AS Type_,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Only( Category ) AS Category_&lt;/P&gt;
&lt;P&gt;RESIDENT&lt;/P&gt;
&lt;P&gt;&amp;nbsp; DATA&lt;/P&gt;
&lt;P&gt;GROUP BY&lt;/P&gt;
&lt;P&gt;&amp;nbsp; %Id, Incident_year;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a look at the attached QVW for example of both.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="2016-01-14 #1.PNG" class="jive-image image-1" src="/legacyfs/online/111566_2016-01-14 #1.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jan 2016 23:21:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077158#M645150</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2016-01-13T23:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: Do I use a loop for this?</title>
      <link>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077159#M645151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gijsbert,&lt;/P&gt;&lt;P&gt;That's not what I want.&lt;/P&gt;&lt;P&gt;Let's suppose that one %Id has ten records, each with a different sequence_nr.&lt;/P&gt;&lt;P&gt;- if ONE of those contains type 'L', (sequence_nr not important) then I just want THAT record. The rest must be discarded.&lt;/P&gt;&lt;P&gt;- if NONE of those contains type 'L', but ONE of those contains type 'O', then I just want THAT record - the rest must be discarded.&lt;/P&gt;&lt;P&gt;- if NONE of those contains either 'L' or 'O', but one contains type 'P', then I just want THAT one - the rest must be discarded.&lt;/P&gt;&lt;P&gt;- if NONE of those contains either 'L' or 'O' or 'P', but one contains type 'W' then I just want THAT one - the rest must be discarded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So: If you have one %Id for ten records, and they ALL have 'P', then I only want one, prefereably the one with the lowest sequence_nr.&lt;/P&gt;&lt;P&gt;If there is ONE type record for an %Id, then there is no need for testing: I just want that one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this clears my problem. The L-O-P-W order is leading. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2016 07:05:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077159#M645151</guid>
      <dc:creator>hansdevr</dc:creator>
      <dc:date>2016-01-14T07:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: Do I use a loop for this?</title>
      <link>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077160#M645152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Marco and Petter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again, I get the feeling I didn't explain my case properly, so I will repeat the post I did for Gijsbert:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The order LOPW is NOT a sorting order, it's the order of IMPORTANCE for de-doubling records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's suppose that one %Id has ten records, each with a different sequence_nr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;if ONE of those contains type 'L', (sequence_nr not important) then I just want THAT record. The rest must be discarded.&lt;/LI&gt;&lt;LI&gt;if NONE of those contains type 'L', but ONE of those contains type 'O', then I just want THAT record - the rest must be discarded.&lt;/LI&gt;&lt;LI&gt;if NONE of those contains either 'L' or 'O', but one contains type 'P', then I just want THAT one - the rest must be discarded.&lt;/LI&gt;&lt;LI&gt;if NONE of those contains either 'L' or 'O' or 'P', but one contains type 'W' then I just want THAT one - the rest must be discarded.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So: If you have one %Id for ten records, and they ALL have 'P', then I only want one, prefereably the one with the lowest sequence_nr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If there is ONE type record for an %Id, then there is no need for testing: I just want that one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this clears my problem. The L-O-P-W order is leading in the de-doubling of record sets.. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2016 07:12:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077160#M645152</guid>
      <dc:creator>hansdevr</dc:creator>
      <dc:date>2016-01-14T07:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: Do I use a loop for this?</title>
      <link>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077161#M645153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Perhaps like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14527979191616186 jive_text_macro" jivemacro_uid="_14527979191616186"&gt;
&lt;P&gt;Temp:&lt;/P&gt;
&lt;P&gt;Load *, RecNo() as Sort Inline [&lt;/P&gt;
&lt;P&gt;Type&lt;/P&gt;
&lt;P&gt;L&lt;/P&gt;
&lt;P&gt;O&lt;/P&gt;
&lt;P&gt;P&lt;/P&gt;
&lt;P&gt;W&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;LEFT JOIN (Temp)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;LOAD * Inline [&lt;/P&gt;
&lt;P&gt;%Id, Sequence_nr, Type, Category&lt;/P&gt;
&lt;P&gt;90010100, 1, L, A&lt;/P&gt;
&lt;P&gt;90010100, 2, P, A&lt;/P&gt;
&lt;P&gt;90010102, 1, P, A&lt;/P&gt;
&lt;P&gt;90010103, 1, P, B&lt;/P&gt;
&lt;P&gt;90010103, 2, W, B&lt;/P&gt;
&lt;P&gt;90010107, 1, O, C&lt;/P&gt;
&lt;P&gt;90010109, 1, O, A&lt;/P&gt;
&lt;P&gt;90010109, 2, P, A&lt;/P&gt;
&lt;P&gt;90010110, 1, W, D&lt;/P&gt;
&lt;P&gt;90010110, 2, O, D&lt;/P&gt;
&lt;P&gt;90010111, 1, F, H&lt;/P&gt;
&lt;P&gt;90010111, 2, C, H&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Data:&lt;/P&gt;
&lt;P&gt;Noconcatenate&lt;/P&gt;
&lt;P&gt;LOAD * Resident Temp&lt;/P&gt;
&lt;P&gt;Order By %Id, Sort;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Drop Table Temp;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Right Join (Data)&lt;/P&gt;
&lt;P&gt;LOAD %Id, FirstValue(Type)&amp;nbsp; as Type&lt;/P&gt;
&lt;P&gt;Resident Data&lt;/P&gt;
&lt;P&gt;Group By %Id&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2016 18:58:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077161#M645153</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-01-14T18:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: Do I use a loop for this?</title>
      <link>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077162#M645154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thnx, Gijsbert, I will try this with my original table! &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jan 2016 06:56:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Do-I-use-a-loop-for-this/m-p/1077162#M645154</guid>
      <dc:creator>hansdevr</dc:creator>
      <dc:date>2016-01-15T06:56:19Z</dc:date>
    </item>
  </channel>
</rss>

