Use the Property-Map-DecisionTree method in to evaluate a decision tree ( Rule-Declare-DecisionTree rule type) and store the result as the value of a property.
In the Diagram tab of a flow rule, the Decision shape can reference a decision tree.
This method has four parameters:
|PropertyName||Optional. Identify a target property to contain the results of the evaluation. (You can't use a local variable here.)|
|DecisionTreeName||Enter the name — second key part — of a decision tree. The system uses the class of the step page (or primary page) as the Applies To key part.|
Optional. Enter a literal value or property reference that is the source value
for the decision tree evaluation.
When provided, this value is used for comparisons in the top-level structure of the true, for evaluations with no left-hand value, such as:
When you leave this blank, the system uses the value of the Property field on the Input tab of the Decision Tree form for the rule.
Select to cause decision tree processing to continue even if a referenced
property is not present on the clipboard. For a
Clear to cause Decision Tree processing to halt if processing references a property that is not present on the clipboard. This causes the system to store an output parameter DecisionTreeStatus with value "NotFound" on the parameter page of the activity.
The system forms a decision tree key using the second parameter and the class of the step page or primary page. It uses rule resolution to locate the decision tree to be evaluated.
It then takes as input to the decision tree evaluation either the value of the third parameter, or the value of the Property field on the Input tab of the decision tree. It evaluates the decision tree in the context of this input value and the current clipboard.
It stores the results in the property you identify in the first parameter. Typically, the flow referencing this decision tree chooses which connector to follow from the decision shape based on this property value.
Trapping not found conditions
If the AllowMissingProperties parameter is not selected and a needed property is not present on the clipboard, the Property-Map-DecisionTree method places an output parameter DecisionTreeInvalidProperty on the parameter page of the current activity. This output parameter identifies the name and class of the missing property.
This facility can be useful in those situations where a user can be prompted for the missing property. The Pega Community article cited below provides an example.
Checking the method status
This method updates the pxMethodStatus property. See How to test method results using a transition.
Pega Community noteSee the Pega Community article How to evaluate a decision tree and handle errors.
ArticleAbout Decision Trees