Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
jyothish8807
Master II
Master II

Peek doubt

Hi All,

I am confused with peek function.Can any one please explain me step by step how it is getting evaluated?

Date(If( Currency=Peek(Currency),Peek(FromDate) - 0.1,'1/1/2014)) as ToDate

how is Currency=Peek(Currency) is being checked?

Peek pulls the last entry as i know.Please any one can explain with example.

Regards

KC

Best Regards,
KC
Labels (1)
7 Replies
Not applicable

Date(If( Currency=Peek(Currency),Peek(FromDate) - 0.1,'1/1/2014)) as ToDate


if (currency=peek(currency))  means   here   in currency table you are going to select one value  if that value equal to peek(currency)  means in currency table last entry      then     date(peek(fromdate) -o.1 )     else   date(1/1/2014)


still if ur in confusion put expression in front end text box and check by step by step  .


here date function tell how to show date



jyothish8807
Master II
Master II
Author

Thanks for reply Manoj,

Suppose i have 6 entries for Currency then how is it being compared.

eg.

Currency

a

a

b

b

b

c

Now if i write currency=peek(currency) how is it being compared?

a=c

a=c

b=c

b=c

b=c

c=c

Am i right?

Regards

KC

Best Regards,
KC
Not applicable

qlikview stores data uniquely only ,  thats is the beauty of qlikview

no worries about duplicate data just go through that expression u will get output

jyothish8807
Master II
Master II
Author

I am getting the output, but want to know how is it evaluated. Cant understand the operation.

Regards

KC

Best Regards,
KC
Not applicable

see if u have common data in database and while loading data in qlikview  ,by default qlikview stores data unique only.

as per ur example   if u have

Currency

a

a

b

b

b

c

but this stores in qlikview like

currency

a

b

c

only but in backend it  relation ship with   a=c,a=c,b=c,b=c,c=c

thats we can see  so that we can say qlikview is an associate in memory techknowledgy  . it stores data in ram

maxgro
MVP
MVP

add a unique field  to see the peek on all records

1.png

Tmp:

load * inline [

Currency

a

a

b

b

b

c

];

Final:

NoConcatenate

load rowno() as id, Currency,

peek(Currency) as PeekCurrency,

Currency=peek(Currency) as CurrencyEqPeekCurrency

Resident Tmp;

drop table Tmp;

MarcoWedel
MVP
MVP

Hi,

one example:

LOAD *,

    Date(If( Currency=Peek(Currency),Peek(FromDate) - 0.1,'1/1/2014')) as ToDate

Inline [

Currency,FromDate

a,1/10/2014

a,1/20/2014

b,2/11/2014

b,2/21/2014

b,3/12/2014

c,3/22/2014

];

ToDate is calculated this way:

If the Currency value in one loaded record is equal to the previous loaded value (the record before) then ToDate gets the FromDate value of this previous record minus 0.1 days (= 2.4 hours = 2hours 24minutes).

If the Currency value in one loaded record is not equal to the previous loaded value then ToDate gets January 1st 2014 as Date value.

QlikCommunity_Thread_141373_Pic1.JPG.jpg

The subtraction of 0.1 from the previous FromDate creates a fractional part in the date field, so it's becoming a timestamp rather than an integer date value. The time part equals 9:36 pm.

QlikCommunity_Thread_141373_Pic2.JPG.jpg

hope this helps

regards

Marco