In this step, we will define the different branches of the decision tree object that serves as the tax calculation function's top expression.
In the Object Manager
panel of the application, under the Detail
section, choose the Contained Objects
tab.
In the Contained Objects
tab page, choose type Function
and selectTAX_CALCULATOR
.
The TAX_CALCULATOR
function opens in the Object
Manager
panel.
Choose TAX_CALCULATION
expression in the Top Expression
field.
The decision tree opens in the Object Manager
panel.
Decision Tree Definition: Initial Screen
Assign result data object.
Next to Result Data Object
, choose (Graphical Access
).
In the context menu, choose Select...
In the Object Query
dialog box that appears, select the PAYABLE_TAX_AMOUNT
data object and choose Select
.
The data object is added as a result data object.
Assign a root node.
We start the decision tree with a check to find out whether a given income falls into the value range we have defined for low income. To accomplish this, in the context menu of the node, choose
The selected expression is set as the root node and two child nodes (positive and negative) appear under the root node as shown below.
Decision Tree Definition: Check For Low Income
Add conditions and results to the child node. For the first condition, a positive result indicates that the income in question falls into the range of low income. Because of that, we have to assign the corresponding tax calculation formula for low income to that child node:
In the context menu of the positive child node, choose
.The expression is added as the result of the child node.
In the context menu of the negative child node, we have still to decide if the income in question is medium or high. To model this decision, choose
.The expression is added as the condition of the child node.
Similarly, add the following expressions as results to the decision tree.
CALCULATE_TAX_FOR_MED_SALARY
CALCULATE_TAX_FOR_HIGH_SALARY
Decision Tree Definition: Complete Definition
Save the decision tree.