Jalz Posted November 6, 2012 Posted November 6, 2012 Hi Guys, need some help please. Ive been searching on Briandunnings and fmfunctions website and I can't find anything I can use easily. I have the following inputs: No_of_Weeks = 5 StartDate = 11/5/2012 Week_Holidays [ 11/12/2012 11/19/2012 ] I want to calculate and end date based adding 5 weeks to the start date. The problem is if there are any holidays within 5 week range, I need it to add a further week(s). Any help would be appreciated. Not really looked at recursive custom functions before
comment Posted November 6, 2012 Posted November 6, 2012 I want to calculate and end date based adding 5 weeks to the start date. The problem is if there are any holidays within 5 week range, I need it to add a further week(s). Let us be very clear here: if there is any number of holidays within the 5 weeks following StartDate, you want to add 6 weeks to StartDate? What if there are any holidays in the 6th week itself? Also, where is the holidays list coming from?
Jalz Posted November 6, 2012 Author Posted November 6, 2012 Hi Comment, thanks for replying. Sorry, the way I phrased the question was vague. For everyone week of holiday, I want the number of weeks to extend by 1 (so the final end date increases to take account for the holidays). You've the nail right on the head, in my example above, I have two (they are weekly) holidays that are within the 11/5/2012...12/10/2012 (5 weeks), so I want it it to add another two weeks ultimately making my end date become 12/24/2012. However if the 12/24/2012 is a holiday and the week beyond that is a holiday, I want the end date to be a date which isn't a holiday. The holiday list is coming from a portal, i'm using the list() to gather the details. The more I think about it, I think I may try and script it and use a script trigger as my head is buzzing thinking about CF....
comment Posted November 6, 2012 Posted November 6, 2012 IIUC, you need to have two loops here: the outer loop takes a week at a time, and counts until it reaches 5 "clean" weeks. The inner loop goes over the days of the currently processed week and checks them against the list of holidays. If you're scripting this, you could use a relationship here to fetch the holidays falling in the currently processed week - otherwise you need a list of all holidays later than StartDate. It's not that complicated, but it is a lot of work.
Recommended Posts
This topic is 4467 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now