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

Create a MasterCalendar with Month and Year

Hi,

I've a Startdate (2013-10-01) and Enddate (2015-01-01). On Load my calendar should be generate a Startdate like Oct 13 and an Enddate like Sep 15.

Regards Stefan

Nachricht geändert durch Stefan Fischer

14 Replies
Anonymous
Not applicable
Author

Script will not working?

TempDate:
Load * Inline [
month
'2013-10-01',
'2015-09-15'
]
;


LET vStart = num(date#(month,'YYYY-MM-DD'));
LET vEnd = num(date#(year(month)&'-09-15','YYYY-MM-DD'));


Calendar:
LOAD Month, Year(Month) as Year;

//
LOAD
AddMonths($(vStart), iterno() -1) as Month
AUTOGENERATE(1)
WHILE AddMonths($(vStart), iterno() -1) <= $(vEnd);


MasterCalender:
LOAD
Date(Month, 'MM') as mon_MM,
Date(Month, 'MMM YY') as mon_MY
Resident Calendar

Gysbert_Wassenaar

That depends of your definition of 'working'. But most likely no, it will not work.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

And what's wrong?

Gysbert_Wassenaar

What I said before. You didn't define the variable 'month'. Try using the peek function to get the value from the TempDate table instead.

TempDate:
Load * Inline [
month
'2013-10-01',
'2015-09-15'
]
;


LET vStart = num(date#(peek('month',0),'YYYY-MM-DD'));
LET vEnd = num(date#(peek('month',-1),'YYYY-MM-DD'));


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Hi, now it works.

TempDate:
Load * Inline [
minDate, maxDate
2013-10-01, 2015-09-01]
;

Let vStart = num(date#(Fieldvalue('minDate',1),'YYYY-MM-DD'));
Let vEnd = num(date#(Fieldvalue('maxDate',1),'YYYY-MM-DD'));

DROP Table TempDate;

Calendar:
LOAD Date(Month,'YYYY-MM-DD')as Month, Year(Month) as Year;

LOAD
AddMonths($(vStart), iterno() -1) as Month
AUTOGENERATE(1)
WHILE AddMonths($(vStart), iterno() -1) <= $(vEnd);