<?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: Is there a way to make a load incrementing a variable? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Is-there-a-way-to-make-a-load-incrementing-a-variable/m-p/556273#M207675</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;... one more small modification:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;If(Peek('&lt;STRONG&gt;DOCUMENT&lt;/STRONG&gt;')=DOCUMENT, Peek('Key'), RangeSum(Peek('Key'),1) ) as Key&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;you tried to compare the DOCUMENT name with the calculated number of the document...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;"How many QlikView experts does it take to calculate a counter?" &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;cheers,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Oleg Troyansky &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 01 Sep 2013 16:53:37 GMT</pubDate>
    <dc:creator>Oleg_Troyansky</dc:creator>
    <dc:date>2013-09-01T16:53:37Z</dc:date>
    <item>
      <title>Is there a way to make a load incrementing a variable?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-there-a-way-to-make-a-load-incrementing-a-variable/m-p/556270#M207672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I have a table with DOCUMENT status that has no other key than order number, and I need to create this keys during the load ordering by date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like this will create me this second key beggining from 1 for each DOCUMENT:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLE1:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DOCUMENT,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATE,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; STATUS&lt;/P&gt;&lt;P&gt;FROM TABLE;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vkey = 1;&lt;/P&gt;&lt;P&gt;vlastkey = 0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DOCUMENTS:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DOCUMENT,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATE,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; STATUS,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(vlastkey &amp;lt;&amp;gt; DOCUMENT, 1, vkey) as DETAIL_KEY,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LET vkey =&amp;nbsp; IF(vlastkey &amp;lt;&amp;gt; DOCUMENT, 1, vlastkey + 1 as vlastkey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LET vlastkey = DOCUMENT,&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;RESIDENT TABLE1 ORDER BY DOCUMENT, DATE;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I implement the last 3 lines of this load?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Aug 2013 20:53:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-there-a-way-to-make-a-load-incrementing-a-variable/m-p/556270#M207672</guid>
      <dc:creator>rcandeo</dc:creator>
      <dc:date>2013-08-30T20:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to make a load incrementing a variable?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-there-a-way-to-make-a-load-incrementing-a-variable/m-p/556271#M207673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't know what your data looks like and I am not sure that I have understood what you want to achieve, but whenever you want to have a counter inside a load, the Peek() function is a good tool. And you can use it so that it references the field that you currently create.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could try something similar to the following&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(Peek(Key)=DOCUMENT, Peek(Key), RangeSum(Peek(Key),1) ) as Key&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In other words: if Peek(Key) = DOCUMENT then you take the same number of Key as in the above record. But DOCUMENT has changed, you increase Key with 1. You need to use RangeSum() since Peek() on the first record will evaluate to NULL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 31 Aug 2013 08:21:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-there-a-way-to-make-a-load-incrementing-a-variable/m-p/556271#M207673</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2013-08-31T08:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to make a load incrementing a variable?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-there-a-way-to-make-a-load-incrementing-a-variable/m-p/556272#M207674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;... a small modification:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt; If(Peek('Key')=DOCUMENT, Peek('Key'), RangeSum(Peek('Key'),1) ) as Key&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 31 Aug 2013 09:29:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-there-a-way-to-make-a-load-incrementing-a-variable/m-p/556272#M207674</guid>
      <dc:creator>luciancotea</dc:creator>
      <dc:date>2013-08-31T09:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to make a load incrementing a variable?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-there-a-way-to-make-a-load-incrementing-a-variable/m-p/556273#M207675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;... one more small modification:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;If(Peek('&lt;STRONG&gt;DOCUMENT&lt;/STRONG&gt;')=DOCUMENT, Peek('Key'), RangeSum(Peek('Key'),1) ) as Key&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;you tried to compare the DOCUMENT name with the calculated number of the document...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;"How many QlikView experts does it take to calculate a counter?" &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;cheers,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Oleg Troyansky &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Sep 2013 16:53:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-there-a-way-to-make-a-load-incrementing-a-variable/m-p/556273#M207675</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2013-09-01T16:53:37Z</dc:date>
    </item>
  </channel>
</rss>

