Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Master calendar

Hi,

i'm new to Qlilview and i'm working on a master calendar script . I want to generate the calender for next year starting from January of each year.

So this is my script :

LET varMinDate = Num(MakeDate(YYYY, 1 ,1));

LET varMaxDate = Num(MakeDate(YYYY,12,31));

//*************** Temporary Calendar ***************

TempCalendar:

LOAD

$(varMinDate)+IterNo()-1 AS Num,

Date($(varMinDate)+IterNo()-1,'DD/MM/YYYY') AS TempDate

AUTOGENERATE 1 WHILE $(varMinDate)+IterNo()-1<= $(varMaxDate);

//*************** Master Calendar ***************

Dim_Date:

NoConcatenate

LOAD

TempDate ,

WeekYear(TempDate) &'/ S'& week(TempDate) AS id_Date,

WeekYear(TempDate) AS Year,

Year(TempDate) &'/ M '& month(TempDate) AS YearMonth,

//day(TempDate) AS Day,

//weekday(TempDate) AS WeekDay,

Week(TempDate) as Week

RESIDENT TempCalendar

ORDER BY TempDate Asc;

DROP Table TempCalendar;

Any suggestions ?

Regards,

Ameni

1 Solution

Accepted Solutions
Not applicable
Author

I changed the lines to :

LET varMinDate =Num(MakeDate(year(AddYears(Today(),-1)), 1 ,1));

LET varMaxDate = Num(MakeDate(year(AddYears(Today(),1)),12,31));

So i got year 2014 , 2015 and 2016

grateful for your help everyone

View solution in original post

5 Replies
maxgro
MVP
MVP

just change these lines in your script

LET varMinDate = Num(MakeDate(year(AddYears(Today(),1)), 1 ,1));

LET varMaxDate = Num(MakeDate(year(AddYears(Today(),1)),12,31));

Not applicable
Author

Massimo thank you for your reply , the thing is i need it to keep the previous 2 years too.Any ideas ?

Not applicable
Author

Hi,

You can use like this.

LET varMinDate = Date(MakeDate(year(AddYears(Today(),1)), 1 ,1));

LET varMaxDate = Date(MakeDate(year(AddYears(Today(),10)),12,31));

Not applicable
Author

Hi,

If you need previous 2 years.You can try like this.

LET varMinDate = Date(MakeDate(year(AddYears(Today(),0)), 1 ,1));

LET varMaxDate = Date(MakeDate(year(AddYears(Today(),-2)),12,31));

Not applicable
Author

I changed the lines to :

LET varMinDate =Num(MakeDate(year(AddYears(Today(),-1)), 1 ,1));

LET varMaxDate = Num(MakeDate(year(AddYears(Today(),1)),12,31));

So i got year 2014 , 2015 and 2016

grateful for your help everyone