Early disclaimer... I am not a programmer. I have successfully (so far) snowed everyone I work with here, but make no claims amongst a group of actual professionals.
That said, could you create in ABL logic similar to:
NumberOfDays = EndDate - StartDate
Loop: for each ProdCalDay where ProdCalDay.ModifiedDay > StartDate AND ProdCalDay.ModifiedDay < EndDate
if ProdCalDay.WorkingDay = FALSE then OffDays = OffDays +1
CalculatedDays = NumberOfDays - OffDays
If this provides you with nothing but a good laugh, then my day is also complete...
---In firstname.lastname@example.org, <email@example.com> wrote:
I understand how to set up Calendars. My challenge is how do I figure out the number of work days based on a calendar between two dates.
Example: â€œ PORel.PromiseDt â€“ TODAY â€œ gives me the number of days until the promise date.
If needed, I could calculate the number of weeks between days, take into account what day of the week it is now, and could eventually get to the number of workdays. A glorified version of â€œ PORel.PromiseDt â€“ TODAY â€“ trunc ((PORel.PromiseDt â€“ TODAY) / 7 * 2) is a good approximation of the number of weekdays between the two days.
I just donâ€™t know if anyone has some way of taking into account a calendar.
From: firstname.lastname@example.org [mailto:email@example.com] On Behalf Of gracefulthreads@...
Sent: Thursday, October 24, 2013 8:31 AM
Subject: [Vantage] RE: Days between two dates based on calendar
Use the Production Calendar to set weekends and holidays as non-work days (if your company default production calendar shows weekends as WORKING days, just create a second one). I'm doing that in a couple of BPMs to reset Sales Order and Purchase Order dates... it will be a little hairier in a BAQ but should be doable.
Does anyone know of a way to calculate the number of working days between two dates and base that on the working days of a calendar.
For example, if I have a company calendar that has only M-F as work days, and then has the Thu-Fri off for Thanksgiving, if I want to calculate the days between 10/31/13 and 11/30/13, it would return 19 days (30 days, less 9 weekend days, less the two holidays)?
Iâ€™m trying to do this in a BAQ.