Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi,
I do not know peek function ,how to use that function please explain me with example.about peek function.
Thankyou,
Regards:
Madhu.
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.
Hi Madhu,
Go through this.
http://community.qlik.com/blogs/qlikviewdesignblog/2013/04/08/peek-vs-previous-when-to-use-each
Thanks,
Ram
I use like this LOAD Peek(Product,-1)Resident Product; but it does not work. i attached snipping files below this box.
add on extra field and cchange syntax in resident
use
Load Peek('Product','-1',Product) as fieldname,
1 as J
resident Product;
drop field J;
hope this helps
or
Load Peek('Product','-1') as fieldname,
1 as J
resident Product;
drop field J;
Hi,
check out this
Date | DepositBalnc |
---|---|
15/06/2005 | 500 |
18/06/2005 | 1500 |
20/06/2005 | 200 |
21/06/2005 | 600 |
25/06/2005 | 100 |
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
Date | Available | DepositBalnc |
---|---|---|
15/06/2005 | 0 | 500 |
18/06/2005 | 500 | 1500 |
20/06/2005 | 2000 | 200 |
21/06/2005 | 2200 | 600 |
25/06/2005 | 2800 | 100 |
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..
Thank you sunil
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
please mark it as helpful correct if you got solution