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.
- In the header of Dev Studio, click .
- In the Label field, enter a name that describes the purpose of the decision tree.
- In the Apply to field, select the class in which you want to create the decision tree.
- Click Create and open.
- Select the branch to display the columns.
- Define a condition and a result:
Choices Actions Define a single condition - In the first field, enter a property or a value.
- In the drop-down list, select a comparator.
- In the next field, enter a property or value that your application compares against the first property or value.
- In the then list, select return.
- In the last field, enter a property or value result that you want your application to return.
Define nested conditions - In the first field, enter a property or a value.
- In the drop-down list, select a comparator.
- In the next field, enter a property or value that your application compares against the first property or value.
- In the then list, select continue.
- Select the next branch to display the columns.
- Define a nested condition by providing a property or value, a comparator, and a result.
- Optional: To create complex conditions, click Add row, and then repeat step 6.
- In the otherwise section, define the behavior of your application
if all of the conditions evaluate as false:
Choices Actions Return a value - From the list, select Return.
- In the Default return value field, enter a value that you want to use.
- Optional: To configure your application to perform an action, click Take actions, click Add a row, and then define the action.
Perform an action - From the list, select Take action.
- Click Actions.
- Click Add a row.
- Define an action by setting a value for the action property.
- Optional: To ensure that your application can process the tree, check the tree for conflicts by clicking Show conflicts on the toolbar.
- Optional: To increase the possibility of reaching a return value, test for completeness of the tree by clicking Show completeness on the toolbar.
- Click Save.
Previous topic About Decision Trees Next topic Completing the Decision tab (Advanced format)