Returns the contents of the fieldname in the record specified by row in the input 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 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.
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 input table.
peek( 'Sales', -2 )
returns the value of Sales from the second last record read into the current input 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.
add on extra field and cchange syntax in resident
Load Peek('Product','-1',Product) as fieldname,
1 as J
drop field J;
hope this helps
Load Peek('Product','-1') as fieldname,
1 as J
drop field J;
Let suppose you have a table with a field name as DepositBalnc,and Your requirement is to create a new field with available balance by formula available=DepositBalnc+available and initially available is 0,output table is
now peek() loads the already loaded field value in the table. now the Available field can be created by following Script
If(RowNo() = 1, 0, Peek(Available)+DepositBalnc) as Available,
Hope now you will understand peek() use..
peek() function works within the load block if you dont mention the table name.
but out of the load block you have to use table name like
peek(Product,-1,'Product') try this