Bindings Tab
The form editor for rule templates provides an additional tab, the Bindings tab, with two sections that are not found in the Rule editor: Bindings and Views (bindings
and
views
in the source view).
Bindings
A binding is used like a local variable whose value is assigned by WebStudio users when defining business rules.
When defining a rule template, you can use bindings in condition checks and in action statements. For example, suppose you define a binding called
dollarAmount
. You could then define a condition as follows:
output.UNIT_PRICE > dollarAmount;
At runtime, the
UNIT_PRICE
is checked against the specific dollar amount defined in the business rule.
Similarly, you could use the binding in an action statement as follows:
RuleFunctions.matchFound(match,null,dollarAmount);
When executed, the engine calls the
matchFound
rule function and passes the value of
dollarAmount
as defined in the business rule.
Bindings are primitive types. You can optionally provide an initial value, and the value can be defined using a domain model. You can specify a domain model by clicking in the Domain Model cell, and then clicking the
Browse icon. If a domain model is specified for a binding, the view defined for a rule template displays the input field for the binding as a drop-down box. In the following example, the String binding
day
is initially assigned to the value of
Monday
, and it is tied to the domain model
RuleFunctions.WeekDays
.
String day = "Monday" (RuleFunctions.WeekDays);
Views
In the Views section of the Bindings tab, you select a view that you have already defined. The selected view is used in WebStudio to present the rule template to the users and enable them to define the business rules (that is, executable rules).
If you do not associate a view with a rule template, a builder-based interface is used.