Counting Business Days

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
pbrad
Posts: 781
Joined: Mon Jul 17, 2006 11:03 pm
Location: Ontario, Canada

Counting Business Days

Post by pbrad »

Hi,

I am trying to figure out how to calculate the number of business days between two dates.

I have VacationRequest.BeginningDate and VacationRequest.EndDate. Is it possible to adapt COUNT and BUSINESS_DAY_FORWARD somehow to perform this function?


Thanks,
Pete
christopherb
Posts: 304
Joined: Fri Jun 22, 2007 8:26 pm

Post by christopherb »

Pbrad,

This should work for you....

DAY_DIFFERENCE (VacationRequest.BeginningDate,VacationRequest.EndDate)

This will will return the an integer constant you can use for whatever you need.


Christopher
pbrad
Posts: 781
Joined: Mon Jul 17, 2006 11:03 pm
Location: Ontario, Canada

Post by pbrad »

Thanks, but is that business days or just days?
christopherb
Posts: 304
Joined: Fri Jun 22, 2007 8:26 pm

Post by christopherb »

You did mention business days.... my bad

You could do that with a process containing some functions. Give me a little background on the typical vacation policy for the organization that would be using this application.


Chris
pbrad
Posts: 781
Joined: Mon Jul 17, 2006 11:03 pm
Location: Ontario, Canada

Post by pbrad »

Hi Chris,

I appreciate the assistance. Their vacation policy is that they have a set number of vacation days available to them within a calendar year and I want to track what they have used up and what they have available to them. I could just get them to request dates that are not weekends and count the days that they request but I was hoping to just get them to choose the beginning and end dates of their vacations and have the system calculate the vacation days between those two dates excluding weekends and statutory holidays.

Cheers,
Pete
aware_support2
Posts: 595
Joined: Sun Apr 24, 2005 2:22 am
Contact:

Post by aware_support2 »

Pete,

Try adding a numeric attribute DayCount with default value of 0 and the following rule to object VacationRequest:

If BUSINESS_DAY_FORWARD(VacationRequest.BeginningDate, VacationRequest.DayCount) <= VacationRequest.EndDate
Then INCREASE VacationRequest.DayCount BY 1

Tick the While Semantics checkbox on the Advanced tab for the rule. This will force the rule to execute repeatedly until the calculated date moves past the vacation end date. See the While Semantics sections in the User Guide for details on how it works.
Aware IM Support Team
pbrad
Posts: 781
Joined: Mon Jul 17, 2006 11:03 pm
Location: Ontario, Canada

Post by pbrad »

Great thanks. I will give it a try.

Pete
Post Reply