Calculating a end date based on the start date and duration with out weekend days

Hi Folk’s ,  If I increase the  start date, then total duration days will add to start date after that end date will calculate  without consider the weekend days. How can achieve that Could you please help me in this case.                                                                                      Thank you !!!
1 answers

The easiest sollution I think would be to create all the days for the years you are using. So for instance create all the days for this year and the next lets say 15 years. The addDays function is your friend here so you can create a variable with the start of the current year and then add one day each time to do the creation process. When creating the day check if this is a working day or a weekend day. With the formatDate function you can check which day of the week this is (you could even use a enum for that and store it in the object). Also create a boolean that defines if that day is a weekend or a workday. We need it for the xpath retrieve later. After you have done this I would create a workflow that based on two parameters returns the resulting day. The two parameters is the day you want to calculate from (ie your startdate) and the total duration days. You now only have to do a custom retrieve (with limits and offset) where the limit is one and the offset is your duration and where the XPath is that the Date > startdate and where the workday boolean is set to true. The sorting must be set to Date. Since this XPath would only retrieve all the dates later then the startdate (in the correct order due to the sort) that are working days the limits and offset makes it that it retrieves the correct single date. Note that this retrieves is a list of one so use the head function to pass that object as return object.