<?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 simple distinct problem in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/simple-distinct-problem/m-p/150645#M28625</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not really sure what you're trying to do here. However, when doing the resident load you have a where condition that looks at rows where not exists ean-code. All values exist already since you're doing a resident load so the values can be found in the field ean-code. Therefore no rows will be loaded.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Jul 2009 19:46:43 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2009-07-30T19:46:43Z</dc:date>
    <item>
      <title>simple distinct problem</title>
      <link>https://community.qlik.com/t5/QlikView/simple-distinct-problem/m-p/150642#M28622</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Should really be able to do this by now !!!&lt;/P&gt;&lt;P&gt;The file could contain multiple product codes for a ean-code, I only want one ean-code in the end table. I have tried the following but my second table keeps coming back empty, am I totally missing something or am I going about this in the wrong way ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ta,&lt;/P&gt;&lt;P&gt;Gav.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;Gav:&lt;/EM&gt;&lt;BR /&gt;&lt;B&gt;LOAD&lt;/B&gt; "ean-code",&lt;BR /&gt; "p-code";&lt;BR /&gt;&lt;B&gt;SQL&lt;/B&gt; &lt;B&gt;SELECT&lt;/B&gt; "ean-code",&lt;BR /&gt; "p-code"&lt;BR /&gt;&lt;B&gt;FROM&lt;/B&gt; PUB.eancode;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;Gavdist:&lt;/EM&gt;&lt;BR /&gt;&lt;B&gt;load&lt;/B&gt; [ean-code],&lt;BR /&gt; [p-code],&lt;BR /&gt; recno() &lt;B&gt;as&lt;/B&gt; int&lt;BR /&gt; &lt;B&gt;&lt;/B&gt;resident Gav &lt;B&gt;where&lt;/B&gt; &lt;B&gt;not&lt;/B&gt; exists([ean-code]);&lt;BR /&gt;&lt;B&gt;drop&lt;/B&gt; &lt;EM&gt;field&lt;/EM&gt; &lt;EM&gt;int;&lt;/EM&gt;&lt;BR /&gt;&lt;B&gt;drop&lt;/B&gt; &lt;B&gt;table&lt;/B&gt; &lt;EM&gt;Gav;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jul 2009 22:37:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/simple-distinct-problem/m-p/150642#M28622</guid>
      <dc:creator />
      <dc:date>2009-07-29T22:37:23Z</dc:date>
    </item>
    <item>
      <title>simple distinct problem</title>
      <link>https://community.qlik.com/t5/QlikView/simple-distinct-problem/m-p/150643#M28623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;your code is chopped, really hard to understand what was there...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The answer to loading a list of distinct values is using a keyword "distinct" :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;load distinct&lt;/P&gt;&lt;P&gt;ean_code&lt;/P&gt;&lt;P&gt;from ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, if you are loading more than one field, "distinct" applies to all values. So, if you have 2 Items for the ame EAN code (I won't tell you to UCC :-)), you need to use grouping and some kind of selective criteria to pick one item over the others. As a simplistic example, you can always pick the highest value. For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;load distinct&lt;/P&gt;&lt;P&gt;ean_code,&lt;/P&gt;&lt;P&gt;MaxString (item_number) as Item&lt;/P&gt;&lt;P&gt;from...&lt;/P&gt;&lt;P&gt;group by ean_code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;Oleg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jul 2009 23:37:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/simple-distinct-problem/m-p/150643#M28623</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2009-07-29T23:37:07Z</dc:date>
    </item>
    <item>
      <title>simple distinct problem</title>
      <link>https://community.qlik.com/t5/QlikView/simple-distinct-problem/m-p/150644#M28624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin:0cm 0cm 10pt;"&gt;Thanks for the reply,&lt;/P&gt;&lt;P style="margin:0cm 0cm 10pt;"&gt;Not sure what happened to the code, have fixed now.&lt;/P&gt;&lt;P style="margin:0cm 0cm 10pt;"&gt;Can I use group by on a resident table ? I can't seem to get it to work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jul 2009 17:40:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/simple-distinct-problem/m-p/150644#M28624</guid>
      <dc:creator />
      <dc:date>2009-07-30T17:40:07Z</dc:date>
    </item>
    <item>
      <title>simple distinct problem</title>
      <link>https://community.qlik.com/t5/QlikView/simple-distinct-problem/m-p/150645#M28625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not really sure what you're trying to do here. However, when doing the resident load you have a where condition that looks at rows where not exists ean-code. All values exist already since you're doing a resident load so the values can be found in the field ean-code. Therefore no rows will be loaded.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jul 2009 19:46:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/simple-distinct-problem/m-p/150645#M28625</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-07-30T19:46:43Z</dc:date>
    </item>
    <item>
      <title>simple distinct problem</title>
      <link>https://community.qlik.com/t5/QlikView/simple-distinct-problem/m-p/150646#M28626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin:0cm 0cm 10pt;"&gt;Thanks for replying,&lt;/P&gt;&lt;P style="margin:0cm 0cm 10pt;"&gt;That makes since, the situation is that I am reading a table in via SQL in a pre-determined order. I am then trying to only get the first (or last , I can change the SQL order) instance of ean-code and the corresponding p-code, I can't use distinct because the p-code will be different. I have tried a combination of lastvalue() and group by but keep coming up with a Invalid expression error.&lt;/P&gt;&lt;P style="margin:0cm 0cm 10pt;"&gt;Ta,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jul 2009 19:58:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/simple-distinct-problem/m-p/150646#M28626</guid>
      <dc:creator />
      <dc:date>2009-07-30T19:58:11Z</dc:date>
    </item>
    <item>
      <title>simple distinct problem</title>
      <link>https://community.qlik.com/t5/QlikView/simple-distinct-problem/m-p/150647#M28627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin:0cm 0cm 10pt;"&gt;Thanks for the help, the group by worked fine, I have it working now. Thanks again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jul 2009 22:17:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/simple-distinct-problem/m-p/150647#M28627</guid>
      <dc:creator />
      <dc:date>2009-07-30T22:17:36Z</dc:date>
    </item>
  </channel>
</rss>

