Try OpenEdge Now
skip to main content
BPM Events User's Guide
The rule language : Time operations and expressions : Business time
 

Business time

BPM Events supports a basic notion of business time, which is based on the calendar that is defined and installed in Business Process Portal Administration. The calendar that is installed and defined as the default calendar is also referred to as the system calendar. Business time can also be based on another calendar that is defined and installed in Business Process Portal and is specifically specified; this is referred to as the specified calendar. For more information, see Business Process Portal Administrator’s Guide.
Business time is specified by adding a "b" to the duration and dueDate functions, as in bduration and bdueDate. The bduration and bdueDate functions are based on the business time definition described in the Business Process Portal Administrator’s Guide.

Using the bdueDate function

The bdueDate function returns the due date by adding the duration in milliseconds to a give date. This calculation is based on the system calendar. If no system calendar is defined, then an error is raised. An example of this function based on the system calendar follows;
bdueDate (startDate: date, duration: int): date
The following sample returns the due date by adding two hours to the event date. The due date is calculated based on the system calendar defined in the system:
val dt2 : date = bdueDate(evt1.date, 2*60*60*1000) ;
The following bdueDate calculation is based on the given calendar. If the specified calendar is not defined, then an error is raised. An example of this function based on the given calendar follows;
bdueDate (startDate: date, duration: int, calendarName: string): date
The following sample returns the due date by adding two hours to the event date. The due date is calculated based on the calendar specified in the argument:
val dt3 : date = bdueDate(evt1.date, 2*60*60*1000, "sbmcalendar") ;

Using the bduration function

The bduration function returns the difference in time between the end date and the start date in milliseconds. This calculation is based on the system calendar. If no system calendar is defined, then an error is raised. An example of this function based on the system calendar follows;
bduration (startDate: date, endDate: date): int
The following sample returns the duration between the event date and due date dt2 calculated in the previous bdueDate function. The duration is calculated based on the system calendar defined in the system. It returns a value of two hours:
val dur2 : int = bduration(evt1.date, dt2) ;
The following bduration calculation is based on the given calendar. If the specified calendar is not defined, then an error is raised. An example of this function based on the given calendar follows;
bduration (startDate: date, endDate: date, calendarName: string): int
The following sample returns the duration between the event date and due date dt3 calculated in the previous bdueDate function. The duration is calculated based on the calendar specified in the argument. It returns a value of two hours:
val dur3 : int = bduration(evt1.date, dt3, "sbmcalendar") ;