Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
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
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
I am getting the output, but want to know how is it evaluated. Cant understand the operation.
Regards
KC
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
add a unique field to see the peek on all records
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;
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.
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.
hope this helps
regards
Marco