Decision trees
You can use Decision trees to handle logic that returns a result from a set of test Conditions. Decision trees can evaluate against different test Conditions and properties. A true comparison can lead to additional comparisons.
For example, a human resources application contains a Process for assessing a job candidate. The candidate receives a set of ratings during the interviews. These ratings are evaluated to determine whether to extend a job offer to the candidate. A Decision tree is configured to automatically use the ratings as test Conditions to decide whether the candidate is qualified. The Decision starts at the top of the tree and proceeds downward. Each yes advances the evaluation. The result is either Not qualified or Eligible for job offer.
The following figure shows the job evaluation Decision tree:
You can reference Decision trees in flow Rules, declare Expressions, activities, or routers.
The following video describes the structure of a Decision tree:
Video transcript
Like a Decision table, a Decision tree consists of a set of Conditions to evaluate, and results to return. Unlike a Decision table, however, a Decision tree consists of a series of branches that contain more- and more-specific Conditions, ultimately leading to a return value.
You have reached the end of the video.
Condition branches
Decision trees contain Condition branches — a comparison value, a comparison operator, and an Action. The Action can be to return a result, to continue the evaluation, or stop the evaluation. The branches are organized in a hierarchical tree structure. Typically, you specify common Conditions and results at the trunk of the tree. You then extend the tree outward to more-specific Conditions and their Actions. When the Decision tree is invoked, the system evaluates the top row and continues until it reaches a result that evaluates to true. The result is returned to the system. If the system processes through all the branches but does not reach a returned result, the system returns the final otherwise value.
The following figure shows how to configure a condition in a Decision tree:
Nested branches
You can organize Decision tree branches in a nested structure. For example, assume that when a purchase request is submitted, three possible outcomes exist. The first Condition states that if the request is for more than USD100, then the request must be routed for approval. Two possible approval results exist. If the Consulting department submits the request, the request advances to the Compliance department for approval. Otherwise, the request advances to the work manager for approval. If the request is for less than USD100, then approval is not needed.
The following image shows how the Decision tree would be configured to advance the request correctly. Note that the department approval Condition is nested beneath the purchase request Condition. The purchase request Condition must be true before the department approval Condition is evaluated. If the request is for less than USD100, the tree does not need to evaluate the request any further and returns the result Not needed:
Check your knowledge with the following interaction:
This Topic is available in the following Module:
If you are having problems with your training, please review the Pega Academy Support FAQs.
Want to help us improve this content?