Try OpenEdge Now
skip to main content
BPM Events User's Guide
The rule language : Time operations and expressions : Date conversion functions : Converting a date using a long-coded Java date in a rule
Converting a date using a long-coded Java date in a rule
BPM Events provides a conversion function toDate(), that generates a Date value from any string that represents a Java internal date representation (long integer, representing the number of milliseconds since January 1, 1970, 00:00:00 GMT). For example, use this function on any event attribute necessary as a date in a rule, except for the date attribute of the event itself (named "date").
The following example illustrates the use of the toDate() function. It assumes that the deadline of a task is coded as a Java date in the event attribute duedate. The rule schedules a reminder event for firing two business days before the due date.
rule reminder
activated by event1 of BP Server::W_ACTIVATED{WORKSTEPNAME : "DoTask"
then {
schedule("tasktimeout", toDate(EVT_1.context.duedate) - 2*B_DAY, event1,
type:"TimeOut", value:"TimeOutCheck", messagetype:"reminder");
We can use projection functions directly on a date expression:
(toDate(EVT1.deadline).month > 10 )
The condition above is true if the deadline attribute of the event has a month equal to November or December.