Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
i am using qlikview v11.
i got currency script from forum that i have pasted below.but it showing script error . this error might be of peek function.
Let zMaxExchangeDate = peek('MaxExchangeDate');
zMaxExchangeDate showing null.
I have attach error msg pls find
Pls help
T_LastDate:
LOAD
max([End Date]) As MaxExchangeDate
From 'E:\Currency\HisCurrency.qvd'(qvd);
Let zMaxExchangeDate = peek('MaxExchangeDate');
DROP Table T_LastDate;
For zi = zMaxExchangeDate + 1 to Today()
Let dd = Date(zi, 'MM/DD/YY');
[HisCurrency]:
LOAD
Date(Today()) as [End Date],
[Units/1 USD] as [USD/KES],
Year(Today()) as Year,
Month(Today()) as Month,
Day(Today()) as Day,
Week(Today()) as Week,
WeekYear(Today()) & '-' & Num(Week(Today()),'00') as RollingWeek,
Weekday(Today()) as WeekDay,
Date(MonthStart(Today()),'YYYY-MM') as RollingMonth,
Right(year(Today()),2) & '-Q' & ceil(Month(Today())/3) as [YearQtr],
'Q' & Ceil(Month(Today())/3) as Quarter
(html, codepage is 1252, embedded labels, table is @1);
Next
Concatenate (HisCurrency)
LOAD * From HisCurrency.qvd (qvd)
Where Not(Exists([End Date]));
Store [HisCurrency] into HisCurrency.QVD;
I would usually do this in a while loop instead of a for loop. Something like this:
SET zi = zMaxExchangeDate;
DO WHILE zi < Today()
....
LET zi = zi + 1;
....
LOOP
Jonathan
Hi,
Use this one.
Ex:
T_LastDate:
LOAD
Num(max([End Date])) As MaxExchangeDate
From 'E:\Currency\HisCurrency.qvd'(qvd);
Let vDateMin = Num(MakeDate(2010,4));
Let zMaxExchangeDate = if(IsNull(Num(peek('MaxExchangeDate',0,'T_LastDate'))),Num(MonthEnd(Today())),peek('MaxExchangeDate',0,'T_LastDate'));
LOAD
Date($(vDateMin) + IterNo() - 1, '$(DateFormat)') as Date,
Date($(vDateMin) + IterNo() - 1, '$(DateFormat)') as DocDate,
.....
AUTOGENERATE 1
WHILE $(vDateMin)+IterNo()-1<= $(zMaxExchangeDate);
Thank u for replaying
i have fixed the issue.