LinkedIn
Copied!

Table of Contents

Creating decision trees

Version:

Only available versions of this content are shown in the dropdown

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 Create Decision Decision 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:

    Choices Actions
    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.

      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.

      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:

    Choices Actions
    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.

      Change a case status by defining the following action: Set pyUpdateCaseStatus equal to Resolved-Rejected.
    Perform an action
    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.

      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.

    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.
    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.

    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 Collaboration Center to ask questions, engage in discussions, share ideas, and help others.