Is the ExchangeDate field a string perhaps? Could you possibly post a copy of the qvd here?
Looking back, I omitted the quotes around the field name in the peek in my earlier post .
I changed the peek function, it works now.
Thanks a lot for all your help!
here, you find the code.
I didn't add the extra code you suggested. That you will have to do yourself.
The only problem left now is that the values in ToEur and FromEur are sometimes numeric, sometimes text.
I don't know what's going wrong. Can you tell me, if you are going to use the code yourself, if you also have this problem?
Max(ExchangeDate) As MaxExchangeDate
From EuroRates.qvd (qvd);
Let zMaxExchangeDate = Peek('MaxExchangeDate');
DROP Table T_LastDate;
For zi = zMaxExchangeDate + 1 to Today()
Let dd = Date(zi, 'MM/DD/YY');
Date(Today()-$(i)) as ExchangeDate,
[EUR/1 Unit] as ToEUR,
[Units/1 EUR] as FromEUR,
Year(Today()-$(i)) as Year,
Month(Today()-$(i)) as Month,
Day(Today()-$(i)) as Day,
Week(Today()-$(i)) as Week,
WeekYear(Today()-$(i)) & '-' & Num(Week(Today()-$(i)),'00') as RollingWeek,
Weekday(Today()-$(i)) as WeekDay,
Date(MonthStart(Today()-$(i)),'YYYY-MM') as RollingMonth,
Right(year(Today()),2) & '-Q' & ceil(Month(Today())/3) as [YearQtr],
'Q' & Ceil(Month(Today()-$(i))/3) as Quarter
(html, codepage is 1252, embedded labels, table is @1);
LOAD * From EuroRates.qvd (qvd)
Store EuroRates into EuroRates.QVD;
i already managed to make it work, thank you.
attached is the currency model i built. my use of it is a little diffrent than yours since i want to hold all exchange rates from and to Euro / Dollar.
i added the peace of code i suggested so that model is updates once a day every day and gets only the new rates.
i didnt see any text / numeric problems in the result.
looking at your code, i think there is a mistake ( or somthing i dont understand)
you use 'zi' as a parameter for the loop but use ' i ' for the caculation of dates. how does ' i ' get his +1 step?
all your date and time calculations are based on '(
Today()-$(i))' while the date in the html string is based on 'zi'. this will give you the right exchange rates for the wrong dates.
anyway, if you use the the "if" i suggested, the process will finish after 1 second which is good, and than if you only need a range of dates you select them in a different QVW and in case you need different dates for other implementations, you already have your updated QVD and dont need to recreate it again.....
I just saw the problem you discuss.
I must have changed the variables somewhere and forget to change them all.
The code did work, but didn't add new data.
I took your code and adjusted it to fit all the currencies I need.
I still have the problem with the numeric & the text values.
Here you see a picture.
I also put my QVD here, could you check if you see the same?
I have no idea why this happens...
My code is exaclty the same as yours, I only have more than 1 currency