4 Replies Latest reply: Jun 10, 2015 7:32 AM by Martijn Noorda RSS

    Peek function

    Martijn Noorda



      I use an incremental load to load 3 reports into qlikview. I have written my code so that a table is created with the reports from the latest date for which all reports are available. The table looks like this (in order of loading):




      file                        report category

      filename1                    Category1

      filename2                    Category2  

      filename3                    Category3


      In my script I write the following code:


      let vReport1=peek('file',fieldindex('rapport','Category1'),'table1')

      let vReport2=peek('file',fieldindex('rapport','Category2'),'table1')

      let vReport3=peek('file',fieldindex('rapport','Category3'),'table1')


      I would think this code gives me the filename of the file that I want to load, but apparently every vReport leads to the same result; it always results in filename3, even though the fieldindex formula returns a different number. What am I doing wrong here?


      Thanks in advance for your help.

        • Re: Peek function
          Stefan Wühl

          What do the fieldindex() functions return as value for each call?


          And what does this return as variables value:


          let vReport1=peek('file',0,'table1');

          let vReport2=peek('file',1,'table1');

          let vReport3=peek('file',2,'table1');



          Does your Table1 only holds three records or duplicate records per file?

            • Re: Peek function
              Martijn Noorda

              fieldindex('rapport,'Category1') yields value 1

              fieldindex('rapport,'Category2') yields value 2

              fieldindex('rapport,'Category3') yields value 3

              Table1 only has the 2 fields that I described, filename and category

              Please note that I loaded category as right(filename, 6), since the last bit of the filename describes to which category it belongs.

              When I load table1 and create a table object, I see no duplicate values. Just the 3 file names and their respective categories.

              vReport1=peek('file'0,'table1) also yields filename3. No matter which number I use as a row number in the peek function, it returns the same filename. Even when I use 10, even though there are only supposed to be 3 rows in my table.