<?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: Peek or previous? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Peek-or-previous/m-p/982948#M644008</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If(RowNo() = 1,&lt;/P&gt;&lt;P&gt;&amp;nbsp; IF(SchedLine = 0, &lt;/P&gt;&lt;P&gt;&amp;nbsp; 'dummy',&lt;/P&gt;&lt;P&gt;&amp;nbsp; right(Message,Len(Message)-Index(Message,':',2)-8)&lt;/P&gt;&lt;P&gt;&amp;nbsp; ), // if rowno = 0, set to dummy unless CS line&lt;/P&gt;&lt;P&gt;&amp;nbsp; if(SchedLine = 1, &lt;/P&gt;&lt;P&gt;&amp;nbsp; right(Message,Len(Message)-Index(Message,':',2)-8), &lt;/P&gt;&lt;P&gt;&amp;nbsp; PEEK(CurrentSchedule,-1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp; ) AS CurrentSchedule,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Dec 2015 15:46:44 GMT</pubDate>
    <dc:creator>Mark_Little</dc:creator>
    <dc:date>2015-12-09T15:46:44Z</dc:date>
    <item>
      <title>Peek or previous?</title>
      <link>https://community.qlik.com/t5/QlikView/Peek-or-previous/m-p/982945#M644005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to process a log file from nPrinting in my script. I want (eventually) to have a summary report of any errors, and the current schedule and task when the error occurred. nPrint log files look like this:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="LOG.jpg" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/108457_LOG.jpg" style="height: 112px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;When it reads the second line, I want to set a field "CurrentSchedule" to "Outbound Touch Report". using&lt;/P&gt;&lt;P&gt;right(Message,len(Message)-index(Message,';',2)-8)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want "Outbound Touch Report" to be set as CurrentSchedule until the NEXT line with "Run Schedule" appears, at which&lt;/P&gt;&lt;P&gt;point it will be replaced by the new value of CurrentSchedule, and so on. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried, among other things,&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;//&lt;/TD&gt;&lt;TD&gt;If(RowNo() = 0,&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;//&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;if(SchedLine = 0, 'dummy',right(Message,Len(Message)-Index(Message,':',2)-8)), // if rowno = 0, set to dummy unless CS line&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;//&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;if(SchedLine = 1, right(Message,Len(Message)-Index(Message,':',2)-8), Previous(CurrentSchedule))) AS CurrentSchedule,&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but that gives me an error "field CurrentSchedule not found". (SchedLine is a flag set in my Select statement)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only other thing I can think of is to write a procedure to this, but I'm sure it can be done in the script; I'm just not sure of the syntax. Can anyone help? thanks, Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 14:31:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Peek-or-previous/m-p/982945#M644005</guid>
      <dc:creator />
      <dc:date>2015-12-09T14:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: Peek or previous?</title>
      <link>https://community.qlik.com/t5/QlikView/Peek-or-previous/m-p/982946#M644006</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;What error are you getting or what is the problem?&lt;/P&gt;&lt;P&gt;I would normally started my Statement like&lt;/P&gt;&lt;P&gt;IF ROWNO() =1,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But doesn't seem to be the problem. Does the field CurrentSchedule exist in the data?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Previous() works on load.&lt;/P&gt;&lt;P&gt;Peek() works after, so can reference a field you are creating.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So try the peek.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 15:32:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Peek-or-previous/m-p/982946#M644006</guid>
      <dc:creator>Mark_Little</dc:creator>
      <dc:date>2015-12-09T15:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: Peek or previous?</title>
      <link>https://community.qlik.com/t5/QlikView/Peek-or-previous/m-p/982947#M644007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, "Current Schedule" does not exist in the data. As I noted, the error message I get is "field CurrentSchedule not found". I am trying to create this field. The problem is getting an initial value! i.e. in RowNo()=0 - that's the first row read in, which MIGHT (or might not) contain the "Run Schedule" trigger, there's no value for CurrentSchedule. I tried to set it in my first IF (If RowNo()=0, if(SchedLIne = 0, 'dummy', ...) so that there would be a value for Previous(CurrentSchedule) when it read RowNo()=1, but that doesn't seem to work. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 15:38:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Peek-or-previous/m-p/982947#M644007</guid>
      <dc:creator />
      <dc:date>2015-12-09T15:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: Peek or previous?</title>
      <link>https://community.qlik.com/t5/QlikView/Peek-or-previous/m-p/982948#M644008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If(RowNo() = 1,&lt;/P&gt;&lt;P&gt;&amp;nbsp; IF(SchedLine = 0, &lt;/P&gt;&lt;P&gt;&amp;nbsp; 'dummy',&lt;/P&gt;&lt;P&gt;&amp;nbsp; right(Message,Len(Message)-Index(Message,':',2)-8)&lt;/P&gt;&lt;P&gt;&amp;nbsp; ), // if rowno = 0, set to dummy unless CS line&lt;/P&gt;&lt;P&gt;&amp;nbsp; if(SchedLine = 1, &lt;/P&gt;&lt;P&gt;&amp;nbsp; right(Message,Len(Message)-Index(Message,':',2)-8), &lt;/P&gt;&lt;P&gt;&amp;nbsp; PEEK(CurrentSchedule,-1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp; ) AS CurrentSchedule,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 15:46:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Peek-or-previous/m-p/982948#M644008</guid>
      <dc:creator>Mark_Little</dc:creator>
      <dc:date>2015-12-09T15:46:44Z</dc:date>
    </item>
    <item>
      <title>Re: Peek or previous?</title>
      <link>https://community.qlik.com/t5/QlikView/Peek-or-previous/m-p/982949#M644009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Mark, that did the trick!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 16:13:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Peek-or-previous/m-p/982949#M644009</guid>
      <dc:creator />
      <dc:date>2015-12-09T16:13:18Z</dc:date>
    </item>
  </channel>
</rss>

