Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

what is peek function?

what is peek function?

7 Replies
jonasheisterkam
Partner - Creator III
Partner - Creator III

You can find it in the help.

If you use it outside a load in the script you can get a value from a table cell by pointing to row number and field name. In a load you can look on a other dataset of the load.

tresesco
MVP
MVP

Have you gone through help?

peek(fieldname [ , row [ , tablename ] ] )

Returns the contents of the fieldname in the
record specified by row in the internal table tablename. Data are fetched from the associative QlikView
database.

Fieldname must be given as a string (e.g. a quoted
literal).

Row must be an integer. 0 denotes the first
record, 1 the second and so on. Negative numbers indicate order from the end of
the table. -1 denotes the last record read.

If no row is stated, -1 is assumed.

Tablename is a table label, see Table Labels, without the ending
colon. If no tablename is stated, the current table
is assumed. If used outside the load statement or referring to another table,
the tablename must be included.

Examples:

peek( 'Sales' )

returns the value of Sales in the previous record
read ( equivalent to previous(Sales) ).

peek( 'Sales', 2 )

returns the value of Sales from the third record read
from the current internal table.

peek( 'Sales', -2 )

returns the value of Sales from the second last
record read into the current internal table.

peek( 'Sales', 0, 'Tab1' )


returns the value of Sales from the first record read
into the input table labeled Tab1.

Load A, B, numsum( B, peek(
'Bsum' ) ) as Bsum...;


creates an accumulation of B in Bsum.

Similarly, search for Exists() in help. Non exists() is negation of exists() and not a separate function.

Not applicable
Author

where?

Not applicable
Author

Hi Shivali,

The Peek  function is an inter-record function that allows us to literally peek into previously-read records of a table and use its values to evaluate a condition or to affect the active record (the one being read).

The function takes one mandatory parameter, the field name into which we will "peek", and two optional parameters, a row reference and the table in which the field is located.

For example, an expression like:

       1.   Peek('Date', -2) :>>> This expression will go back two records in the currently-being-read table, take the value on the Date field and use it as a result of the expression.

          2.     peek( 'Price', 2 )  :>>> It returns the value of Price from the third record read from the current internal table.

          3.   peek( 'Price', 0, 'Tab1' ) :>>> It returns the value of Price from the first record read into the input table labeled Tab1.

Not applicable
Author

Hi,

     In Qlikview Help Tab search for peek function

tresesco
MVP
MVP

Open QV->help->using help->index

qv_testing
Specialist II
Specialist II

Hi Shivali,

You can find it in the Qlikview Help..

simple defination

Peek(): can return data from any row based on the row mention in the function....