Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

What is Peek and how to use it

He All,

What is peek function and how to use it any one help with any example.

Thanks

3 Replies
Not applicable

Re: What is Peek and how to use it

hi RitulRaj,

peek is QlikView function it

Returns the contents of the fieldname in the record specified by row in the internal table tablename.

Syntax : peek(Fieldname [ , Row [ , TableName ] ] )

for more info please explore community or QlikView help

Regards

robert99
Valued Contributor II

Re: What is Peek and how to use it

I used peek recently to accumulate by customer by AR invoice (and AR receipts) as follows on this thread (it is the only way I could find to do this).

http://community.qlik.com/message/272221#272221

The issue was to match customer AR invoices with AR receipts on a first in first out basis

Data:

load * Inline [

rowId, trnNo, trnDate, custId, trnType, trnAmount, trnAmt, trnDrAmt, trnCrAmt

1, BNK-1, 01/05/2011, a1, Cr, 31000, 31000, 0, 31000

2, INV-1, 05/05/2011, a1, Dr, 45000,-45000,45000, 0

3, BNK-2, 05/05/2011, a1, Cr, 15000, 15000,0, 15000

4, INV-2, 06/05/2011, a2, Dr, 40000,-40000,40000, 0

5, INV-3, 07/05/2011, a1, Dr, 12000, -12000,12000,0

6, INV-4, 08/05/2011, a1, Dr, 35000,-35000,35000, 0

7, BNK-3, 09/05/2011, a1, Cr, 45000, 45000,0, 45000

8, BNK-4, 20/05/2011, a2, Cr, 20000, 20000,0, 20000

9, BNK-5, 20/06/2011, a2, Cr, 21000, 21000,0, 21000

10, BNK-6, 28/06/2011, a2, Cr, 11000, 11000,0, 11000

];

//  load invoices

DataInv:

LOAD 

    rowId,

    trnNo,

    trnDate,

    custId,

    trnType,

    trnAmount,

    trnAmt,

    trnDrAmt,

    IF(PREVIOUS(custId)=custId,

    PEEK('AccInv'),0)+trnAmount AS AccInv,

    trnCrAmt

resident Data

where trnType = 'Dr'

order by trnType,custId,trnNo,rowId

Gabriel
Valued Contributor II

Re: What is Peek and how to use it

Hi,

This clip, http://qlikshare.com/172 should help your understanding of PEEK.

Hope it helps

Regards

Community Browser