Friday, November 6, 2015

Business Rules, IF THAN, Otherwise

Recently I came across a scenario where the existing business rules implementation fails because the condition which it was checking did not exist.

Rule 1
IF (Name="YATAN")
THAN
FULL_NAME="YATANVEER SINGH"

Rule 2
IF (Name="YAGYA")
THAN
FULL_NAME="YAGYA VIR SINGH"

The above rule works fine to the point it checks for particular inputs YATAN or YAGYA, however as soon as it checks for something else it throws error.

Fact not found in the rule engine working memory, rule session execution failed.
The rule session 26557551 failed because an instance of the fact com.oracle.xmlns.frd_wms.testbr.bpel.ProcessResponse could not be found in the working memory of the rule session.
This is most likely a rule modeling error. The decision service interaction expects the fact instance to exist in the working memory of the rule session. Check the rule actions in rule designer and make sure that a fact of the expected type is being asserted. If the error persists, contact Oracle Support Services.

So we can handle this by putting a otherwise condition, however
After some research, I found that there is  no otherwise :)

So came with a solution (not the smartest)

I put a new rule

Rule 3
IF (Name != "YATAN")  and (Name != "YAGYA")
THAN
FULL_NAME="YUGANSH VIR SINGH"


No comments:

Post a Comment