Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

peek function and group dimensions

Hi All,

Need to understand 2 things.

1. can anybody let me know . is their any actual practical scenarios where we could use a peek function. I know the syntax for peek.. but I just need know to when and at what all situation I need to use a peek function..?

2.the same question for group dimensions?

13 Replies
Gysbert_Wassenaar

Try searching this site for examples. You can find plenty of uses for them.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi gysbert,

I am finding lot of examples.. but I like to understand  on what scenarios a peek should be used?

Gysbert_Wassenaar

You can use peek anywhere where you need to retrieve a value from a record that was loaded previously into Qlikviews in-memory database. Perhaps you want to get the minimum and maximum dates from a field with dates so you can create a table with all the dates between that minimum and maximum value. Or you need to accumulate a value to get a running total in a table. Try searching and limiting the results to blog posts only.


talk is cheap, supply exceeds demand
malini_qlikview
Creator II
Creator II

check the attachment, all lookup functions with example and where it can be used are described

Not applicable
Author

malini where is the attachment

malini_qlikview
Creator II
Creator II

PFA

Not applicable
Author

Hi Gys,

For dates we can always pick max and min right?

secondly I could find an example in the blog as below

load * Inline [

Employee, Address, EmployeeCode

A , XXX, 1
A , XXX, 4
B , YYY, 2
C ,ZZZ, 3
D, QBC, 100
E, LAD, 200

]
;

table:
Load
Employee,
Address,
EmployeeCode,
peek(EmployeeCode, -1, 'Employee') as value
Resident Employee;

is he trying to find the first and last employee

Not applicable
Author

hi gys addition to this I would like to know what is this preveious loaded rows in memory means?

What I understood is in qlikview if reload it today and tomorrow if you reload again it will flush and keep the latest load only

Anonymous
Not applicable
Author

Hi benny,

The Peek function is one of the data transformation techniques and an inter-record script function that allows us to literally peek into previously-read records of a table and Returns the values 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). Returned values are used 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, expressions like:

peek (‘Price ' )
This expression will return the value of Price in the previous record read (equivalent to previous (Price)).

peek (‘Price ', 2)
This expression will return the value of Price from the third record in the currently-being-read table.

peek ('Price', -2)

This expression will return the value of Price from the second last record in the currently-being-read table.

peek (‘Price ', 0, ‘Table’)
This expression will return the value of Price from the first record read into the input table labelled Table.

Please check below posts where peek function is used in real time scenarios:

Populating-a-sparsely-populated-field

Master Calender Creation

The Group by is a clause used for defining over which fields the data should be aggregated (grouped).

groupbyfieldlist ::= (fieldname { ,fieldname } )

Group by must include the fields that are not within an aggregate function, for eg:

table2:

Load

Category,

Name,

Max (Date) as MaxDate

Resident table1 Group by Category, Name .


Regards

Neetha