Skip to Content

Using Rules in Process to filter elements in a list

Consider the following Scenario:

We have a Purchase Order which has a list of Order Items. Based on the type of the Order Item, a discount has to be applied.

Rules can be used to determine the discount based on the type of Order Item. It is as simple as creating a Decision Table with type of the Order Item as condition and discount as action. But, can Rules be designed to loop through the list, filter them based on the type and apply the corresponding discount for each one of the Order Item? Yes! (Otherwise, I wont be writing a blog on this ;))

Solution to this problem is to have one Rule and one Decision Table (as simple as that!). Multiple matches property of the Decision Table has to be set to true and mutually exclusive rows to false. Condition of the Rule should be written on the Order Item element to force the Rule Engine to evaluate all the Order Item elements in the Purchase Order.

There is an article on the same at the following location with a detailed explanation of how to achieve this:

Be the first to leave a comment
You must be Logged on to comment or reply to a post.