"Hit Policy: First" using tblPolicyFirst
In this decision table, a percentage discount is returned based on where an order originated, on the web or by phone, the location of the order, inside or outside the US, and customer type, wholesaler or retail according to the First Hit Policy. When the hit policy, First is in use, only the first entry in the result collection is returned.
This decision table takes three inputs, order, location and customer, and produces one output discount.
{decisionTables: {
"tblPolicyFirst": {
inputs: ["order", "location", "customer"], outputs: ["discount"],
hitPolicy: "F",
rules: [
["web", "US", "wholesaler", 10],
["phone", "-", "-", 2],
["-", "non_US", "-", 0],
["-", "-", "retailer", 5]
]
}
},
formulas: {
"First": { formula: "tblPolicyFirst(,,'web', 'non_US', 'retailer')", finalValue: [] }
}
}
Given the input data passed in formulas, order = web, location = non_US and customer = retailer, two rules are "hit", rule 3 and rule 4. However, since we are using the First Hit Policy, which returns the first successful output, only the result for rule 3 is returned, 0.
"First": { "value": 0 }
|