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

Autogenerate + Select = Master Calendar with holidays

Hi All,

I'm trying to create a master calendar that will have a dim showing date type i.e. holi or working day. Calendar is an autogenerated set but holidays come from sql table (records present only holidays). Please take a look at the below example and suugest what to do to join them.

Input:

--------

LOAD

Date(Date#(20111231,'YYYYMMDD')+RecNo(),'YYYY-MM-DD') AS Date,

AUTOGENERATE Today() - MakeDate(2012, 1, 1) + 1;

SELECT Holiday FROM Holidays

Output:

----------

2012-01-01, holiday

2012-01-02, working day

...

Thanks,

Przemek

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Przemek, see an example:

Input:
LOAD
Date(Date#(20111231,'YYYYMMDD')+RecNo(),'YYYY-MM-DD') AS Date,
AUTOGENERATE Today() - MakeDate(2012, 1, 1) + 1;

HolidayList:
SELECT Holiday FROM Holidays;

Output:
LOAD
Date,
if(exists(Holiday,Date), 'holiday', 'working day') as DateFlag
RESIDENT Input;

DROP TABLES Input, HolidayList;

View solution in original post

2 Replies
Anonymous
Not applicable
Author

Przemek, see an example:

Input:
LOAD
Date(Date#(20111231,'YYYYMMDD')+RecNo(),'YYYY-MM-DD') AS Date,
AUTOGENERATE Today() - MakeDate(2012, 1, 1) + 1;

HolidayList:
SELECT Holiday FROM Holidays;

Output:
LOAD
Date,
if(exists(Holiday,Date), 'holiday', 'working day') as DateFlag
RESIDENT Input;

DROP TABLES Input, HolidayList;

Not applicable
Author

Thank you, Michael. That's exactly what I was looking for.