Comparing Dates in Oracle Business Rule Decision Tables

I have been working with decision tables for some time but have never had a scenario where I need to compare dates. The use case was to check if a persons membership had expired. I didn't think much of it till I started to develop it. The first trap I feel into was trying to create ranges and bucket sets. The other trap I fell into was not converting the date field to a complete date. This may seem obvious to most people but my Google searches came up with nothing so I thought I would create a quick post.

I assume everyone knows how to create a decision table so I'm not going to go through those steps. The prerequisite for this post is to have a decision table with a payload that has a date field. This filed must have the date in the following format YYYY-MM-DDThh:mm:ss.

  1. Create a new condition in your decision table
  2. Right-click on the condition to edit it and select the expression builder



  3. In the expression builder, select the Functions tab.
  4. Expand the CurrentDate file and select date, and click Insert Into Expression button.



  5. In the Expression Builder you need to create an expression that will return true or false, add the operation <= after the CurrentDate.date



  6. In my scenario my date field is memberExpire, Navigate to your date field and expand, select toGregorianCalendar().



  7. Your expression will look something like this, click OK to get back to the decision table



  8. Now its just a matter of checking if the value is true or false.

Simple when you know how :-)


Comments:

What is the best option to implement business rules - Stored Procedures in Database vs Rules Engine

Posted by guest on October 10, 2012 at 06:30 PM GMT+13:00 #

I'm tempted to say depends, but I don't want you to think that one is better than another in certain situations.

The reason for business rules is to provide agility, visibility, and a business context, e.g. no IT required to make changes to a process live.

If you are using PL/SQL to do this there are a few drawbacks, you need to have your code attached to the SOA / BPM project which can be a nightmare to manage during the development life-cycle. You also tie your rules to a particular technology, e.g. DB2, MSSQL, or Oracle. Its not very portable. Obviously there is an operational overhead on this, e.g. the time and effort for someone to learn how to modify the code. Before you know it you have a solution that to impossible to manage.

These are just my thoughts.

cheers
James

Posted by James Taylor on October 10, 2012 at 08:09 PM GMT+13:00 #

hi james my question is somewhat related to this. how does one assert values to an interval? within OBR an interval is of type java.xml.Duration. how can you assert the value much like as if you were setting a value to a string? I have tried using the usual P1D but jdev does not seem to like it.

thanks

Vikram

Posted by vikram on May 02, 2013 at 01:12 AM GMT+13:00 #

I'm not sure exactly sure I understand your use case but there are a few things you can look at. I have used durations before but when you assert a value there are functions where you can assign durations. Just make sure the assertion filed is parameterised, then on the rule assertion when you enter a value there is a little calculator where you can apply duration functions. I'm not sure how SOA Suite or BPM will manage the duration data type.

I'm not sure if you really need the rule to output a duration type though. You could produce a result that you could derive a duration, i.e. d1,h1,... as a string. Then when you use that result back in your SOA process you convert it as required. Using the example in this post you could use conditions like comparing dates to find a duration range.

Cheers
James

Posted by guest on May 02, 2013 at 11:26 AM GMT+13:00 #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Discussions and Examples using Oracle Fusion Middleware. Some image links are broken when using Firefox, Safari, and Chrome. If you want to see the full image please use IE.

Twitter:@james8001

tumblr hit counter vistors, thanks for your support

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today