Decision rules — Concepts and terms |
The Decision category includes five declarative types and five other rule types. For an introduction to the five declarative rules, see Declarative processing — Concepts and terms. The others are:
All of these define computations and comparisons that cause processing to continue along one path or another.
For the first three rule types, a reference to a rule arises in your application, which causes the rule to be evaluated. The results of the evaluation affect later processing. In contrast, the Declare Expression and Declare Constraint rules execute autonomously when required, through an internal mechanism known as forward chaining.
When conditions are the simplest decision rules. A when condition rule evaluates a relationship among one or more property values, and returns true or false. This corresponds to the familiar IF-THEN construct used in many rules systems and programming or scripting environments.
For example, a business rule can state "If the next Monday is a holiday, then orders for next-business-day delivery can be accepted only until 2 P.M. Friday, not the regular 5 P.M. closing time." This rule can be captured in a when condition, as a Boolean (true-false) test among the properties that describe holidays, today's weekday, and the current time.
You can reference when condition rules in numerous other rules. For example, each step in an activity can reference a precondition when condition and a transition. You can conditionalize HTML and XML stream processing based on the when directive (which can reference a when condition rule).
Create a decision tree to capture complex IF-THEN situations that involve multiple tests and criteria. Decision tree rules contain a list of one or more input properties, and can return a property value as a result.
For example, a decision tree can compute and return "today's order cutoff time" as 5 P.M. on most business days, but 2 P.M. if today is a Friday before a Monday business holiday.
In addition to returning a property value result (not limited to true or false), decision trees present the conditions and computations attractively. One decision tree may be easier to compose and understand than five interrelated when conditions.
You can reference decision trees in flows through a decision shape, and in any activity that executes the Property-Map-DecisionTree method.
A map value, like a decision tree, has inputs and results. Use a map value to convert one or two input values (text, numbers, or dates) into a single resulting value, where the decision criteria fit a table or matrix structure. This is a straightforward way to present decisions and computations that depend on ranges of the input values. For example:
"If the test score falls between 91 and 100, assign a grade of A. If the test score falls between 81 and 90, assign a B. Assign C for 71 to 80."
and so on.
You can reference map values in flows through a decision shape, and in any activity that executes the Property-Map-Value or Property-Map-ValuePair method.
Create a collection of related hierarchy rules to define, through rules rather than data objects, a tree structure that can be searched. See About Hierarchy rules.