Decision rules — Concepts and terms |
The Decision category contains rule types that define computations and comparisons. At runtime, these rules calculate a result, or a decision, that causes processing in the application to continue along a particular path.
Some rules are declarative while others perform calculations when they are directly referenced in the application.
This topic describes some different decision rule types. Refer to the full list of rule types in the Decision category for more details.
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.