In this step, we will build up a simple taxation model with three different tax calculation formulas for low, mid, and high incomes. The general approach is to divide an employee's gross salary into three segments and apply an individual tax rate to each of the segments (progressive taxation). The resulting tax amount for each segment will then be added to the total tax amount to be paid on the gross salary. The formula expressions will later be used in a decision tree.
To create the formula expression, you have to navigate to the application in the Object Manager
panel. To do so, choose the Back
button. (You could as well choose the application from the Recently Used
list.)
Under the Detail
section, choose the Contained Objects
tab.
The Contained Objects
tab page opens.
Choose Expression
from the Type
field and choose Create Object
.
In the Object Creation
dialog that appears, choose Formula
from the Type
field.
Enter Calculate_tax_for_low_salary in the Name
field.
Enter Amount to be paid in the Short Text
field.
Choose Create and navigate to object
.
You are navigated to the formula builder page.
Formula Editor
Assign a result data object by choosing (Graphical Access
).
In the context menu, choose Select...
.
In the Context Query
dialog box that appears, select PAYABLE_TAX_AMOUNT
. This is the data object that you have already created in the context of defining a result data object for the function.
It is added as the result data object.
In the context menu of the formula field, choose
.In the Context Query
dialog box that appears, select GROSS_SALARY
. Again, this is a data object you have already created before in the context of defining the function's context data.
The data object gets added to the formula.
Choose the*
button.
Choose the Number
button.
In the Insert
dialog box that appears, enter 0.1 and choose OK
.
The number appears in the Formula
field.
Save the formula expression.
Create the following formula expressions for the mid and high salary segments using the above procedure.
Name of the Formula Expression |
Result Data Object |
Formula |
---|---|---|
Calculate_Tax_for_med_salary |
|
(25000 EUR * 0.1) + (Gross_Salary - 25000 EUR) * 0.2 |
Calculate_Tax_for_high_salary |
|
(25000 EUR * 0.1) + (75000 EUR * 0.2) + (Gross_Salary - 100000 EUR * 0.3) |
Note
When you look at the fomulas in Expert Mode
, amounts will be displayed, for example, as 25000$EUR. Don't let yourself get confused by the “$EUR” part. The salary currency is Euro (currency code EUR), while the $ sign
is inserted automatically by the system as an internal separator between the number and the currency part of the amount. This is needed for the formula to be properly parsed by the system. If the currency in the example was US Dollars, the formula editor would display this as $USD in Expert
Mode
.