Boxed Expressions Overview
As we mentioned in our previous post Decision Model and Notation – DMN in DMN the shareable components between Decision Requirement Diagrams (DRD) are either decisions or Sub-DRDs. Now, the challenge is, how we can share our business formulas across different Decision Tables, or any other type of logic?
The answer is to use Boxed Expressions.
DMN provides a simple tabular format for all of those things, called boxed expressions.
A Boxed Expression is a 2-column table: the first column is ‘Name’ and the second column is ‘Value’ and/or expression. We have several types of value expressions, including literal (constant) expression, function definition and invocation, and so on.
This is an example of a Boxed Expression:
As a part of a project, we need to calculate a Daily Car rate. And Daily Car rate has a fixed formula across different decisions (i.e., Decision Tables, Tree, Natural Language, etc.). The Daily Car rate formula is: Car rate + GPS rent rate
For implementing this Formula, we create a new Boxed Expression and add all our formulas as follows:
After adding the formulas, we can now use them in our project. For example, as the screenshot shows below, we can call the “Daily Car rate” directly. And in this case, for calculating the “Daily Car Rate” it will calculate the “Car rate” and “GPS rent rate” first.
In this example, we call the “Daily Car Rate” in Natural Language as shown below. Please note that boxed expressions can be used in a Decision Table and all other types of logic:
Depending on the values for “Car rate” and “GPS rent rate”, we will have the “Total Price” value.
Types of Boxed Expressions
We have two types of Boxed Expressions:
- Value formula – similar to what we used in our example.
- Function formula (i.e., value formula with parameters)
Difference between Terms Glossary and Formula Glossary
Now the question becomes, what are the differences between Terms Glossary and Formula Glossary (Boxed expression in DMN)?
The answer is that Terms Glossary is mostly used to facilitate data entry in Decision Tables and Natural Language that allows the definition of business terminologies, their synonyms, and translation in different languages (Culture) as well as value types. On the other hand, Boxed Expression is designed for sharing expressions across all models.
Boxed Expressions allow the sharing of logic (i.e., constraints and conditions, formulas, literals, values, expressions., etc.) across your models. Once these are modeled, they can be reused over and over with business people without worrying about hidden complexity and runtime expression bindings.
There are many different types of boxed expressions, to learn more please visit our Resource Hub.
Last updated October 9th, 2020 at 08:30 am, Published July 6th, 2016 at 08:30 am
VP of Customer Success, leading digital and decision transformation initiatives for customers across industries and ensuring successful project implementations with 10+ years of experience and focus on product innovation, end-to-end customer support, and managing high-performing and talented customer success team.