intelligent, integrated, business process
Blog
Home / Business Rule / Decision Table Advanced Conditions (Simple, Optional, Partial and Calculated Conditions)

Decision Table Advanced Conditions (Simple, Optional, Partial and Calculated Conditions)

0

Decision Table is one of the ways that allows business people to model a decision by modeling rules consisting of visual conditions and actions in a spreadsheet, just like a user interface (e.g., Microsoft Excel, Google Doc, etc.). These models are then executable by an engine and application that is developed by IT, or the business process can invoke them for decision making purposes by:

  1. Executing models by passing input values
  2. Grabbing the return result when the execution is finished

In implementing a Decision Table, there are couple of column types that play a main role in decision implementation:

  • Name (optional column)
  • Condition
  • Action

When entering values in any cell related to a condition column, you are building up a rule for each row.

Let’s have a look at the following example:

image

The way it works is that you define a template expression in each column:

dt-templates

As you can see above, on top of each condition column (e.g., Location, Account, Vendor, etc.) the template expression of the condition is defined (red row).

Depending on the value you enter for a condition and the way the expression of the condition column is set, you define different types of condition:

  • Simple (value based only)
  • Optional
  • Partial (operator + value)
    • Comparison operators i.e. <, <= >, >=, ==, !=
    • Contains operator i.e. in {“VIC”, “SA”, “NSW”}
  • Calculated (full evaluable expression)
  • Range values
  • Multi-values

In this example, as you can see there are some conditions (blue columns) which may have values or are left empty.

Simple conditions:

If cells have only one value, they are called ‘simple conditions’. An expression with be built based on these values from the provided template expression of the related condition column. For example, for the first column in “Location” which has a value of “01” the expression would be “Location == 01”.

Optional conditions:

Conditions are not required for all rules (each row) . Therefore, if a column is left empty, then it is considered as an Optional condition, so it does not participate in building a rule.

For example, in the second row, “Location” and “Type” will be building the rule which is “Location == 01” and “Type == Liquor”

As you can see, all the rows in the “Location” column would follow the same pattern because the template expression applies to all the values in a specific column.

Partial conditions:

When the decision is more complex, then you might need to have a different expression template in the same column of a condition. For example, let’s consider the following decision:

dt-complex-condition

As you can see, on the top of the columns (the expression line in red), the expressions are not included in the operations. Instead, the operation and value are defined in the cells. Therefore you have this flexible behaviour in that your condition expression for the same column (Credit Rating for instance) is different from R1 and R2 (rule number 1 and 2).

In rule 1, the first condition is CreditRating == “A” but for rule 2 the first condition would be CreditRating != “A”.

Calculated conditions:

This is a scenario where no condition expression template is defined for a column.

dt-complex-condition-$value

As you can see in this example, the column for “Credit Card Balance” does not have any condition expression based on any parameters. It starts with : which means the value after that will be evaluated at runtime and then $value which refers to values of the cells. So now the entire condition expression can go to the cell value.
The benefit of calculated conditions is that you can even call to a method, access properties and so on by providing a valid expressions format.

It’s worth mentioning that there are other options to model a Decision Table. You can use our designer, model them in XML or build them programmatically using an API as well. For more information, have a look at our wiki.

To summarize, there are four types of conditions that can be defined: Simple, Optional, Partial and Calculated. These behave differently based on the condition expression template and the values you put in the condition column. This flexibility allows you to implement complex decisions in a way that each row and column has their own characteristics if required.

In the next article, I will cover Range and Multi-values expressions.

Recommended Posts

Leave a Comment

You must be logged in to post a comment
Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.