Databases Reference
In-Depth Information
Select
Calendar.getInstance()
, which will initialize our variable to hold the
current date.
For our second action, we want to calculate the number of days before the specified
start date and place the result into the variable
duration
. To calculate this, we will
make use of the
Duration
extension method provided with the rules engine.
We will do this by defining another
assign new
action in a similar way to the
previous action. The key difference is how we specify the
<expression>
. This time,
instead of selecting a value from the drop-down list, click on the
Expression Builder
icon (circled in the preceding screenshot) to launch the
Expression Builder
for the
rules editor.
The
Expression Builder
provides a graphical tool for writing rule expressions and is
accessed from various parts of the rule editor. It consists of the following areas:
•
Expression
: The top textbox contains the rule expression that you are
working on. You can either type data directly in here or use the
Expression
Builder
to insert code fragments to build up the expression required.
Variables
,
Functions
,
Operators
,
Constants
: This part of the
Expression
Builder
lets you browse the various components that you can insert into
your expression. Once you've located the component that you wish to use,
click the
Insert Into Expression
button, and this will insert the appropriate
code fragment into the expression.
•