Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Creating decision trees

Updated on May 31, 2022

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.

  1. In the header of Dev Studio, click CreateDecisionDecision Tree.
  2. In the Label field, enter a name that describes the purpose of the decision tree.
  3. In the Apply to field, select the class in which you want to create the decision tree.
  4. Click Create and open.
  5. Select the branch to display the columns.
  6. Define a condition and a result:
    ChoicesActions
    Define a single condition
    1. In the first field, enter a property or a value.
    2. In the drop-down list, select a comparator.
    3. In the next field, enter a property or value that your application compares against the first property or value.
    4. In the then list, select return.
    5. In the last field, enter a property or value result that you want your application to return.
      For example: If you want a reporting manager to review any job application from candidates with > than 10 years of work experience, you can create the following condition and result: if .WorkExperience > 10 then return Work Manager.
    Define nested conditions
    1. In the first field, enter a property or a value.
    2. In the drop-down list, select a comparator.
    3. In the next field, enter a property or value that your application compares against the first property or value.
    4. In the then list, select continue.
    5. Select the next branch to display the columns.
    6. Define a nested condition by providing a property or value, a comparator, and a result.
      For example: If the work experience of a job candidate is greater than 10 years, then your application checks whether the candidate has a master's degree.
  7. Optional: To create complex conditions, click Add row, and then repeat step 6.
  8. In the otherwise section, define the behavior of your application if all of the conditions evaluate as false:
    ChoicesActions
    Return a value
    1. From the list, select Return.
    2. In the Default return value field, enter a value that you want to use.
    3. Optional: To configure your application to perform an action, click Take actions, click Add a row, and then define the action.
      For example: Change a case status by defining the following action: Set pyUpdateCaseStatus equal to Resolved-Rejected.
    Perform an action
    Note: In order to select this option, on the Configuration tab, select the Allow selection of additional return actions check box.
    1. From the list, select Take action.
    2. Click Actions.
    3. Click Add a row.
    4. Define an action by setting a value for the action property.
      For example: Change a case status by defining the following action: Set pyUpdateCaseStatus equal to Resolved-Rejected.
  9. Optional: To ensure that your application can process the tree, check the tree for conflicts by clicking Show conflicts on the toolbar.
    For example: If one row checks whether the work experience is greater than 5 years, and the second row checks whether the work experience is greater than 3 years, the second row never evaluates to true because the first row includes the second row condition.
    Result: A warning icon appears in rows that are unreachable or empty.
  10. Optional: To increase the possibility of reaching a return value, test for completeness of the tree by clicking Show completeness on the toolbar.
    Result: The system automatically adds suggested rows of the decision tree that cover additional cases.
  11. Click Save.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us