This decision model specifies decision logic for products up-selling based on the customer profile and already purchased products. It is described at as DMCommunity Challenge “UpSell Rules” when a company wants to offer its customers new products based on the Customer Profile and the products which the customer already has or doesn’t have. This decision model shows how to deals with arrays of objects.
Our decision model represents business logic that determines the following goal “Offered Products” using the following decision table:
The first condition uses the operator “Is One of” to check possible values of the first decision variable “Customer Profile”. The second and third conditions check if “Customer Products” Include or Do Not Include “certain products.
The conclusion uses the operator “Are” to specify the Offered Products”. The second conclusion shows how to use a text variable such as “Recommendation” to explain the selected conclusion. The last rule serves as a default when there is nothing to offer.
This complete list of operators supported by OpenRules can be found in OpenRules User Manual on pages 23-25.
The goal “Customer Profile” can be defined by the following decision table:
To complete our decision model we need to put all decision variables (goals and input variables used in the above tables) in one Glossary:
Testing Decision Model
To test this model, we create test-cases in Excel using the following tables:
- Datatype table that specifies our business concept Customer:
- Data table that specifies test-customers:
- Test cases with expected results defined in this table:
To execute these test-cases, we should adjust the standard file “settings.bat“:To execute these test-cases, we may simply double-click on the standard bat-files “build.bat” and “run.bat”. Our decision model will produce the following results for the second test:You can also look at the generated HTML report that explains which rules were actually executed and why: