More about Decision Trees
Overriding the property
Decision tree evaluation may be based on a known property identified on the Configuration tab, or on a parameter supplied in the Property-Map-DecisionTree method, or both.
If you leave the Property field blank, evaluation is always based on the parameter. If a parameter is supplied, the parameter value is used even when the Property field is not blank.
As an alternative to the Property-Map-DecisionTree method, you can use these standard functions to evaluate a decision tree:
@(Pega-RULES:DecisionTree).ObtainValue(tools, myStepPage, decisiontree, inputproperty)
@(Pega-RULES:DecisionTree).ObtainValue(tools, myStepPage, decisiontree, inputproperty, bAllowMissingProperties)
Decision tree rules can also be evaluated as part of a collection rule ( Rule-Declare-Collection rule type).
Pega Community note
See the Pega Community article How to evaluate a decision tree and handle errors for an example.
Uploading a text file to start
You can create a decision tree by importing (or "harvesting) a specially formatted text file. This capability lets others not familiar with the Pega Platform create decision trees.
The number of nodes in a decision tree is not limited. However, as a best practice to avoid slow performance when updating the form and also avoid the Java 64 KB code maximum, limit your decision trees to no more than 300 to 500 rows.
You can view the generated Java code of a rule by clicking. You can use this code to debug your application or to examine how rules are implemented.
Special processing with Declare Expression calls
When a Declare Expression rule has
Result of decision tree for the Set Property To field, special processing occurs at runtime when a property referenced in the decision table is not present on the clipboard. Ordinarily such decision rules fail with an error message; in this case the Otherwise value is returned instead. For details, see the Pega Community article Troubleshooting: Declarative Expression does not execute when a decision rule provides no return value.
Despite the class name, the Rule-Declare-DecisionTable rule type does not produce forward or backward chaining. Technically, it is not a declarative rule type.
Custom function aliases
You can use Configuration tab to enable custom function aliases instead of the default comparison. For some of those aliases, you can click Select values and select from a list of values that are available for the selected property.
- Property-Map-DecisionTree method
- Application debugging using the Tracer tool
You can test and debug your applications by using the Tracer tool. You can test and debug activities, data transforms, decision rules, service rules, parse rules, and processes. You can select which rulesets, rules, and events to trace; set breakpoints and watch variables; trace reference properties; select which requestor session to trace; and add custom events to Tracer output. You can also troubleshoot offline-enabled applications in a browser by testing scripts that are running when the application is running.
- About Decision Trees
Use a decision tree to record if .. then logic that calculates a value from a set of test conditions organized as a tree structure on the Decision tab, with the 'base' of the tree at the left.
- Creating decision trees
Calculate a value from a set of properties or conditions where true comparisons can lead to additional comparisons, organized and displayed as a tree structure, by creating a decision tree. For example, you can create a condition that checks whether the location of a job candidate is equal to a specific city. If the condition is true, your application evaluates additional conditions, such as work experience and education.
- Viewing rule history
You can view the saved history of a rule to see when it was changed and by whom. You can also compare the current version with a previous version or restore a previous version of a rule for testing purposes, or if the current version is faulty.