Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Decision table is a logical expression for constructing conditional results. Table contains all (and only) the inputs required to determine the output. Moreover, a complete table contains all possible combinations of input values (all the rules).

A decision table consists of;

  • An output label, which can be any text to describe output of the decision table. The result of a decision table must be referenced by decision name, not the output label, in another expression.
  • A set of inputs (zero or more). Each input is made of an input expression and a number of input entries.
  • A set of outputs (one or more). A single output has no name, only a value. Two or more outputs called output variables. Each output variable is named and all output entries is referred as an output clause.
  • A list of rules (one or more) in rows of table.

The decision table shows the rules in a shorthand notation by arranging the entries in table cells. This shorthand notation shows all the inputs in the same order in every rule and therefore has a number of readability and verification advantages.

For example;

Customer CategoryOrder sizeDiscount
"Business"<100.10

read as;

If CustomerCategory = "Business" and OrderSize < 10 then Discount = 0.10

An input expression value satisfies an input entry if the value is equal to the input entry, or belongs to the list of values indicated by the input entry (e.g., a list or a range). If the input entry is ‘-’ (meaning irrelevant), every value of the input expression satisfies the input entry and that particular input is irrelevant in the specified rule.

In general table expressed as;

Input expression 1Input expression 2Output expression
input entry ainput entry boutput entry c

If input entry is "-" (meaning irrelevant), every value of input expression satisfies the input entry.

If rules overlap, multiple rules can match and a hit policy indicates how to handle the multiple matches.

Input expressions

Input expressions are usually simple FEEL expressions. Order of input expressions is not related to any execution order.

Output expressions

A rule output entry is a also FEEL expression. Output expressions also have default value if no output entry is specified.

Hit Policy

The hit policy specifies the what the result of decision table is in cases of overlapping rules, ie. when more than one rule matches the input data. For clarity, the hit policy is summarized with using single character of policy name.

Single and multiple hit tables

A single hit table may or may not contain overlapping rules but returns the output of only one rule. In case of overlapping rules, the hit policy indicates which of the matching rules to select. 

A multi hit table may return the output of multiple rules or a function of outputs. For example, sum of values.

Single hit policies

  • Unique: no overlap possible and rules are disjoint. Only a single rule can be matched. This is default value of hit policy. If given input matches the multiple rules hit policy is incorrect and MultipleHitViolation error is thrown.
  • Any: there may be overlap, but all of the matching rules must equal output entry values for each output so any match can be used. If output entries are non-equal, the hit policy is incorrect and result is undefined.
  • Priority: multiple rules can match, with different output entries. This policy returns the matching rule with the highest output priority. Priorities are independent from rule sequence.
  • First: Multiple (overlapping) rules can match, with different output entries. The first hit by rule order is returned and evaluation halt. First hit tables are not considered good practice because they do not offer a clear overview of the decision logic. 

Multi hit policies

  • Output Order: returns the all hits in decreasing output priority order.
  • Rule Order: returns the all hits in rule order. Therefore may depend on the sequence of rules.
  • Collect: returns the all hits in arbitrary order. An operator can be added to apply simple function to outputs. If no operator specified, result is list of the all output entries.

Collect operators are;

      1. sum (+): sum of all the distinct outputs.
      2. min (<): smallest value of the all the outputs.
      3. max (>): largest value of the al the outputs.
      4. count (#): number of the distinct outputs.

For the Priority and Output order hit policies, priority is decided in compound output tables over all the outputs for which output values have been provided. The priority for each output is specified in the ordered list of output values in decreasing order of priority, and the overall priority is established by considering the ordered outputs from left to right in horizontal tables (i.e., columns to the left take precedence over columns to the right), or from top to bottom in vertical tables. Outputs for which no output values are provided are not taken into account in the ordering, although their output entries are included in the ordered compound output.

For example; if called with Age=17, Risk Category="HIGH" and Dept Review=true, the following table outputs of all four rules, in the order 2,4,3,1.

OAge

Risk Category

(Low, Medium, High)

Dept Review

Routing

(DECLINE,REFER,ACCEPT)

Review Level

(LEVEL2,LEVEL1,NONE)

1---"ACCEPT""NONE"
2<18--"DECLINE""NONE"
3-"HIGH"-"REFER"

"LEVEL 1"

4--true"REFER""LEVEL 2"
  • No labels