A simple decision model dealing with dates

The DMCommunity.org Challenge Oct-2021 offers a simple decision model used by our Red Hat colleagues to demonstrate how the DMN standard deals with dates validity. OpenRules similarly follows the DMN standard as shown in the implementation below.

We added a simple decision project “CardApproval” to the standard workplace “openrules.samples“. It contains two decision tables:

The corresponding Glossary is defined as below:

Here the decision variable “Current Date” is defined using the formula today(). It specified as “const” in the column “Used As” meaning that the Current Date will be calculated only once.

The Environment table is defined here:

And here are several test cases:

When we start OpenRules Explorer it will automatically build the decision diagram:

When we executed the first test it will produce the following results:

To test different Current Dates (e.g. > 2022-01-01) we may change the glossary as below:

Now the default value today() will be assigned to the variable “Current Date” only if this variable is undefined. However, we may define this variable directly in test cases:

Here are new execution results:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.