Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

error

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

  

  

   

    FROM  [http://www.oanda.com/convert/fxdaily?date=$(dd)&date_fmt=us&exch=USD&lang=en&sel_list=KES&value=1&fo...]

    (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;

3 Replies
jonbrough
Specialist
Specialist

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

kumarnatarajan
Partner
Partner

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); 

Not applicable
Author

Thank u for replaying

i have fixed the issue.