Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear All,
I want to display dates from 2008 to 2014
but this code will displaying only 2010 dates
tell some one help me
where i am wrong
set vDateMin = MAKEDATE(2008,1,1);
set vDateMax = MAKEDATE(2014,12,31);
TempCalendar:
LOAD
$(vDateMin) + RowNo() - 1 AS DateNumber,
Date($(vDateMin) + RowNo() - 1) AS TempDate
AUTOGENERATE 1
WHILE $(vDateMin)+IterNo()-1<= $(vDateMax);
MasterCalendar:
LOAD
TempDate AS CreatedDate,
Month(TempDate) AS CalendarMonth,
Year(TempDate) AS CalendarYear,
Month(TempDate) & '-' & Year(TempDate) AS CalendarMonthAndYear
RESIDENT TempCalendar ORDER BY TempDate ASC;
DROP TABLE TempCalendar;
Thanks In Advance
Niranjan
Hi Niru
See the Attachment.
It's very simple and easy to understand. No need of using complex logic and variables Stuff.
Regards
Aviral Nag
I agree with Nag that it's much easier to create the Calendar without using variables. Nag's example can be made even simpler by using preceding load.
MasterCalendar:
LOAD
Date AS CreatedDate,
Month(Date) AS CalendarMonth,
Year(Date) AS CalendarYear,
'Q'&ceil(Month(Date)/3) AS Quarters,
Month(Date) & '-' & Year(Date) AS CalendarMonthAndYear
;
LOAD
date(makedate(2008,1,1)+recno()-1) as Date
AUTOGENERATE makedate(2014,12,31) - makedate(2008,1,1) + 1;
-Rob