2 Replies Latest reply: Jun 3, 2011 1:53 AM by Miguel Angel Baeyens de Arce RSS

    peek vs previous

      please any one explain the peek and previous

       

       

      reddy

        • peek vs previous

          Refer to page No 413 of Qlik View reference manual

          • Re: peek vs previous
            Miguel Angel Baeyens de Arce

            Hello Reddy,

             

            A very simple explanation is that Peek() is used to retrieve information already loaded in your datamodel, either in the current table or in any other table.

             

            Names:
            LOAD * INLINE [
            Name, Code
            A, 100
            B, 200
            C, 300
            ];
            
            LET vThirdValue = Peek('Name', 2, 'Names'); // will return the third value for field "Name" in table "Names". Table Names must be already loaded.
            

             

            Previous() is used when loading a table to get the previous record value for the field specified.

             

            Names:
            LOAD RecordID,
                 Code,
                 Previous(RecordID) AS PreviousID; // stores the previous value for RecordID in a new field called PreviousID
            SQL SELECT RecordID, Code
            FROM Source; 
            

             

            They are used sometimes together to make accumulations in script. There are a lot of examples in the forums.

             

            Hope this helps.

             

            Miguel Angel Baeyens

            BI Consultant

            Comex Grupo Ibérica