<?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: Using Peek for the Next Row in Script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-Peek-for-the-Next-Row-in-Script/m-p/1025231#M346517</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;// test data&lt;/P&gt;&lt;P&gt;&lt;EM&gt;X:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;load&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; RecNo() as CurrentRow,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; date(makedate(2014)+floor(rand()*1000)) as RefDate, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; floor(rand()*10) as ContractNumber&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;AutoGenerate 100;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// add next row e date&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Left join (X)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;load &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; ContractNumber,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; CurrentRow,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; previous(CurrentRow) as NextRow,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; previous(RefDate) as NextRefDate&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident X &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Order By ContractNumber, RefDate desc, CurrentRow;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Feb 2016 20:48:05 GMT</pubDate>
    <dc:creator>maxgro</dc:creator>
    <dc:date>2016-02-12T20:48:05Z</dc:date>
    <item>
      <title>Using Peek for the Next Row in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Peek-for-the-Next-Row-in-Script/m-p/1025229#M346515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone tell me why this isn't working?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;temp:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RowNo() as CurrentRow,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 13.3333px;"&gt;RowNo&lt;/SPAN&gt;() + 1 as NextRow&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OldTable&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Order By&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ContractNumber, refDate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;drop table &lt;SPAN style="font-size: 13.3333px;"&gt;OldTable&lt;/SPAN&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NewTable:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Peek('Date', num#(&lt;SPAN style="font-size: 13.3333px;"&gt;NextRow&lt;/SPAN&gt;)) AS NextRowDate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; temp&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;STRONG&gt;Order By&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ContractNumber, refDate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DROP TABLE &lt;SPAN style="font-size: 13.3333px;"&gt;temp&lt;/SPAN&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to input on the current row a field telling me what is on a specific field on the next row. The 'NextRowDate' is showing a null value instead of the value of the field Date on the next Row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Need help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Feb 2016 17:48:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Peek-for-the-Next-Row-in-Script/m-p/1025229#M346515</guid>
      <dc:creator>eduardo_palacios</dc:creator>
      <dc:date>2016-02-12T17:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using Peek for the Next Row in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Peek-for-the-Next-Row-in-Script/m-p/1025230#M346516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think to look into next row, I would do a sort in descending order and then use the regular way of doing the peek.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Feb 2016 18:00:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Peek-for-the-Next-Row-in-Script/m-p/1025230#M346516</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-02-12T18:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using Peek for the Next Row in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Peek-for-the-Next-Row-in-Script/m-p/1025231#M346517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;// test data&lt;/P&gt;&lt;P&gt;&lt;EM&gt;X:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;load&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; RecNo() as CurrentRow,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; date(makedate(2014)+floor(rand()*1000)) as RefDate, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; floor(rand()*10) as ContractNumber&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;AutoGenerate 100;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// add next row e date&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Left join (X)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;load &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; ContractNumber,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; CurrentRow,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; previous(CurrentRow) as NextRow,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; previous(RefDate) as NextRefDate&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident X &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Order By ContractNumber, RefDate desc, CurrentRow;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Feb 2016 20:48:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Peek-for-the-Next-Row-in-Script/m-p/1025231#M346517</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2016-02-12T20:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using Peek for the Next Row in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Peek-for-the-Next-Row-in-Script/m-p/1025232#M346518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think the reason it's no working is because peek() can work with either one parameter or three parameters, but not with two:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Peek(Field) will give you the previous value of the Field in the current table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Peek(Field, Row, Table) will give you the value of the Field from the specified Row in the specified Table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your example, you didn't specify the table, and that is likely the reason of the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Having said that, I agree that the more intuitive solution is to sort the table in the descending order and retrieve the previous value, instead of the next value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;Oleg Troyansky&lt;/P&gt;&lt;P&gt;Upgrade your Qlik skills at the &lt;A href="http://masterssummit.com/"&gt;Masters Summit for Qlik&lt;/A&gt; - coming soon to Milan, Italy!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Feb 2016 20:56:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Peek-for-the-Next-Row-in-Script/m-p/1025232#M346518</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2016-02-12T20:56:49Z</dc:date>
    </item>
  </channel>
</rss>

