Databases Reference
In-Depth Information
Invoking a function from within a rule
The final step is to invoke the functions as required from our ruleset. Before writing
the additional rules for a vacation of less than 3, 5, and 10 days respectively, we will
update our existing rule to use these new functions.
Go back to the
One Day Vacation
rule, and select the first test (so it has an orange
box around it). Right-click and select
Delete Test
from the drop-down list, as shown
in the following screenshot:
Next, click on
<insert test>
to add a new test to our
IF
clause. Click on the left
operand. This time, instead of selecting an item from the drop-down list, click on the
calculator icon to launch the
Expression Builder
and use it to build the expression:
startsIn(TLeaveRequest.startDate)
Set the value of the operator to
>=
. Finally, enter the value of
14
for the second
operand. Follow the same approach to add another test to check that the leave
duration is only one day. Our updated rule should now looks as shown in the
following screenshot: