Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
Try searching this site for examples. You can find plenty of uses for them.
Hi gysbert,
I am finding lot of examples.. but I like to understand on what scenarios a peek should be used?
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.
check the attachment, all lookup functions with example and where it can be used are described
malini where is the attachment
PFA
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
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
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
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