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.
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 -
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.
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.
-
- 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.
For example: Change a case status by defining the following action: Set pyUpdateCaseStatus equal to Resolved-Rejected.
Perform an action -
From the list, select Perform action.
-
Click Actions.
-
Click Add a row.
-
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.
-
- 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.Note: A warning icon appears in rows that are unreachable or empty. - Optional:
To increase the possibility of reaching a return value, test for completeness of the tree by clicking Show completeness on the toolbar.
Note: The system automatically adds suggested rows of the decision tree that cover additional cases. -
Click Save.
- 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.
- 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.
- Viewing generated Java code of Access When rules