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;
You didn't attached the error, but since you're using peek outside of the Load, you need to indicate which row value you want to set in the variable and which table this value comes from. The peek function without the row parameter (second) and table name parameter(third) can only be used inside the load section of a table.
I think your script should work with the next:
Let zMaxExchangeDate = peek('MaxExchangeDate',0,'T_LastDate');
thank u for replying & Sorry i forgot to attach error.
actualy in variable zMaxExchangeDate
null is coming and therefore it is showing error to for loop as below
Script line error:
For i = zMaxExchangeDate + 1 to Today()
why is this so can u explian.
Thank u
I'm not sure... but are you certain that your "T_LastDate" table loads any values? If it doesn't, that's why the peek function is returning a null value. I'd check the from section of the "T_LastDate" table... I think the single quotes shouldn't be there.