Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
marksmunich
Contributor II

Peek function

When and where to use peek function, what is its importance in qlikview scritpting.

Tags (3)
1 Solution

Accepted Solutions
Not applicable

Re: Peek function

It is used in Script:

- to populate a local variable (from a table content)

- to populate a row N with a value already loaded (row < N) : to populate an empty value (with a preceeding value), to compute a cumulative sum

Fabrice

3 Replies
Not applicable

Re: Peek function

It is used in Script:

- to populate a local variable (from a table content)

- to populate a row N with a value already loaded (row < N) : to populate an empty value (with a preceeding value), to compute a cumulative sum

Fabrice

marksmunich
Contributor II

Re: Peek function

could you provide more explanation , with an example.

Not applicable

Re: Peek function

hi

it is used in script, on output table.

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 , 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.

Community Browser