Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikviewforum
Creator II
Creator II

Looping the CALL function for each day of 2013

I want to use the below CALL function to call the sub-routine which creates the daily QVD. I want to loop the below call function in such a way that it calls the sub-routine for all the dates of 2013 instead of harding the date value in the CALL function for each date.

CALL DailyQvd ('SOURCE_DATA','YYYYMMDD');

Can someone help me out for this?

6 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

LET vNum = DayNumberOfYear(YearEnd('1/1/2013'));

FOR i = 1 TO $(vNum)

  LET vDate = date(YearStart('1/1/2013') + $(i) - 1);

  CALL DailyQvd('$(vDate)', 'YYYYMMDD');

NEXT

If your second parameter specifies the input date format, change the second LET statement to:

  LET vDate = date(YearStart('1/1/2013') + $(i) - 1, 'YYYYMMDD');

qlikviewforum
Creator II
Creator II
Author

Thank you for your effort.

I couldn't see 'SOURCE_DATA' in your script which is my first parameter. Please let me know if it is not clear!

Peter_Cammaert
Partner - Champion III
Partner - Champion III

'SOURCE_DATA' is a string constant. I replaced it with a date value for each successive day in 2013.

If the example code doesn't fit your requirements, please explain what parameter values this SUB expects.

qlikviewforum
Creator II
Creator II
Author

Ok, SUB expects below parameter! Please let me know if you have anymore questions.

SUB DailyQvd ('Sales','20130805');

Peter_Cammaert
Partner - Champion III
Partner - Champion III

I see. This will do better then:

LET vNum = DayNumberOfYear(YearEnd('1/1/2013'));

FOR i = 1 TO $(vNum)

  LET vDate = date(YearStart('1/1/2013') + $(i) - 1, 'YYYYMMDD');

  CALL DailyQvd('SOURCE_DATA', '$(vDate)');

NEXT

qlikviewforum
Creator II
Creator II
Author

Thank You!

I will check and update you shortly....