Hi All,
I have a requirement where i need to generate all the dates between 2 given dates.
I need to do a lookup against HolidaysList for that generated list and also need to exclude Saturdays & Sundays.
Any thoughts on how we can implement this?
Thanks in Advance.
Generate Dates between 2 Dates
Moderators: chulett, rschirm, roy
Should be pretty straight-forward. A job that starts with a Transformer and a hashed file with Holidays in it would get you what you need.
Job parameters could control the start and end date ranges. Create a bogus Stage Variable so the job will compile but you don't (necessarily) need to use it. Convert the dates to internal format so you can simply add 1 to increment a day at a time. There are other transforms to get the 'day number' for each generated date so that you skip any holidays or weekend dates. Then only output valid dates until you exceed the ending date parameter, control that via a constraint. Convert back to external format on the way out in the appropriate format for your target.
Job parameters could control the start and end date ranges. Create a bogus Stage Variable so the job will compile but you don't (necessarily) need to use it. Convert the dates to internal format so you can simply add 1 to increment a day at a time. There are other transforms to get the 'day number' for each generated date so that you skip any holidays or weekend dates. Then only output valid dates until you exceed the ending date parameter, control that via a constraint. Convert back to external format on the way out in the appropriate format for your target.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Re: Generate Dates between 2 Dates
If your main requirement is to find out the number of days between any two given days .
I would say from your calendar table take in all the days starting from Day 1 determine whether its an holiday or a week end. If not then give it a count 1. then keep on incrementing this work day count accordingly. Load the Calendar date and work day count into an hash file.
Then when you come up with the two dates you can look them up and calculate the difference in the transformer.
IHTH.
two cents
I would say from your calendar table take in all the days starting from Day 1 determine whether its an holiday or a week end. If not then give it a count 1. then keep on incrementing this work day count accordingly. Load the Calendar date and work day count into an hash file.
Then when you come up with the two dates you can look them up and calculate the difference in the transformer.
IHTH.
two cents