If IsPartialReload() = 0 Then
Let vMinDate = If(IsNum(MonthStart(PEEK('IdCalendrier',0,'Faits'))),Num(MonthStart(PEEK('IdCalendrier',0,'Faits'))),0);
Let vMaxDate = Num(MonthEnd(PEEK('IdCalendrier', -1,'Faits')));
TMP_Calendar:
Load distinct
Date($(#vMinDate) + IterNo() - 1) as [Date]
AutoGenerate 1
While $(#vMinDate) + IterNo() - 1 <= $(#vMaxDate);
Calendar:
NoConcatenate
LOAD
[Date] as IdCalendrier,
DAY([Date]) AS [Day Date],
Date(Date) AS Date,
MONTH([Date]) AS [Month Date],
Num(MONTH([Date])) AS [Month Num Date],
YEAR([Date]) AS [Year Date],
DATE(makedate(year([Date]),month([Date])),'MMM YYYY') AS [Month Year Date],
DATE(makedate(year([Date]),month([Date]),day([Date])),'DD MMM YYYY') AS [Day Month Year Date],
'S' & Num(Week([Date]),'00') as Week,
'T' & CEIL(num(Month([Date]))/3) as Quarter,
'S' & CEIL(num(Month([Date]))/6) as Semester,
NetWorkDays(Date, Date) as WorkDay
RESIDENT TMP_Calendar;
Drop table TMP_Calendar;
End if
|