Decision tree or Decision table
Differences between decision tables and trees
Both decision tables and decision trees evaluate properties or conditions to return results when a comparison evaluates to true. While decision tables evaluate against the same set of properties or conditions, decision trees evaluate against different properties or conditions.
Decision table
In a decision table, the values in a column evaluate against the same property/operator pair, such as Account type =, to return a value or property. Developers can use a decision table when they have to evaluate many combinations of the same set of properties or conditions to return one value or property. For example, a company uses the number of years at the company and ratings on five employee evaluation metrics to determine bonus eligibility.
Decision tree
Each branch in a decision tree evaluates the property/operator pair against a single value to perform an action, such as return a value or evaluate a nested condition. Developers can use a decision tree when they must evaluate conditions on different properties that may be dependent on other conditions. Each branch in a decision tree is evaluated, and all branches that evaluate to true perform the action that is described after, such as continuing the evaluation to the nested condition. For example, a language learning app is running extensive A/B testing, where some users receive hearts, and other users receive stars for their efforts. The values for hearts and stars are collected in separate properties. A decision tree evaluates the different rewards users are eligible for based on the number of hearts or stars associated with the account.
Considerations for use and configuration
Decision trees perform similarly to decision tables. When selecting which one to configure, consider what conditions are evaluated and where the decision table or decision tree is used.
Decision tables and decision trees cannot always be used interchangeably within Pega Platform™ applications. You can reference a decision table or decision tree on flow rules, declare expressions, activities, or routers. Some configurations, such as cascading approvals with an authority matrix, only support evaluation of decision tables.
The line-by-line structure of the decision tree makes it easy for a business stakeholder or low-code developer to configure and update dependent conditions that evaluate against different properties. If you use a decision table in a situation where few conditions evaluate against the same property, the decision table has empty boxes where a value is not needed for the decision.
The table structure of the decision table makes it easy for a business stakeholder or low-code developer to configure and update a decision that evaluates against many of the same properties.
Consider a wizard that guides bank customers through a set of questions and returns the account type that best fits their needs. The decision can be configured with a decision table or a decision tree. Using a decision table to select an account type results in empty boxes and using a decision tree results in duplicate conditions. In the center of the following image, slide the vertical line to compare the decision table and the decision tree for an account type decision.
Check your knowledge with the following interaction.
Want to help us improve this content?