This rule has a QuoteRequest
as an input fact. This rule will check for the condition of Customer Type
and Item Quality
, and based on these conditions, chain of management approval, level of management approval, and discount offered will be decided.
For all the cases in the CheckCustomer
rule, your condition will keep a check on the Customer Type. For example in first case, if the Input quote
customer type is New
and Quality
is in the range of 0
to 10
then EffectiveDiscount
will have a 10% increment and others values will be set as follows:
If Quote.CustomerType == New and Quote.Quantity Is Between 0-10 Then Set ApprovalFlow.CustomerType = True Set ApprovalFlow.newEffectiveDiscount = Quote.EffectiveDiscount+10 Set ApprovalFlow..Number of Level for approval = 0 Set ApprovalFlow.Tier1ApprovalNeeded = False Set ApprovalFlow.Tier2ApprovalNeeded = False
You can have conditions which that are evaluated to give a fixed value (New
as Customer Type) and/or a range of values. For a fixed value, you can define Globals, and for ranges you will define Bucketsets.
As you will keep evaluating the conditions to a fixed value, you will create a for Customer Type
of the type Global
with value New
. And, as your rule will evaluate to range values too, you will create a Bucketset to be used in rule.
In this section, we will define Globals, as follows:
Global Name |
Type |
Value |
Final |
---|---|---|---|
|
String |
New |
Checked |
New
. Checking the option Final means the Global is Non-modifiable.Next, we define Bucketsets, as follows:
Bucketsets are created to define a list of values or a list of value ranges to limit the acceptable set of values for a fact or a property of a fact in Oracle Business rules. Bucketsets can be defined as Global Bucketsets and local Bucketsets. Global allows reuse, where a Bucketset is named and stored in the data model, and Local is specified when you define a Decision Table and only applies to one condition expression.
CheckCustomer.rules
and select the Bucketsets navigation tab.QuantityBucket
as the Bucketset Name and double
as the Data Type.And by default, you will get a negative Infinity (-Infinity) bucket, which is less than 0. In the Included Endpoint field, check the checkbox to include the bucket endpoint. In the Allowed in Actions field, select the checkbox as appropriate, to include the bucket in the Bucketset allowable values.
How it works...
When you add a bucket to a List of Ranges Bucketset, the value is calculated based on the currently selected bucket value and the next highest bucket value. When you change the endpoint value, the value is automatically sorted in the Bucketset. In a Decision Table, a Bucketset defines value ranges, in the condition section. The Bucketset ranges determine, for each condition expression in a Decision Table, whether it has two or more possibilities. Using a Bucketset, each possibility in a condition expression is divided into groups or ranges where a cell specifies one Bucket of values from the Bucketset (or possibly multiple Buckets of values per cell).
18.226.185.87