5.2 Decision Tables & Decision Trees
Key Takeaways
- Automated decision rules decouple business policies from procedural code, utilizing When rules for binary checks, Decision Tables for structured matrices, and Decision Trees for complex nested hierarchies.
- Decision Tables (Rule-Declare-DecisionTable) organize multi-factor condition columns and return action columns into an intuitive tabular grid.
- Evaluation modes dictate execution flow: 'Stop on first true match' stops upon finding the first valid row, whereas 'Evaluate all rows' processes every row sequentially to execute cumulative assignments.
- Decision Trees (Rule-Declare-DecisionTree) model asymmetric, hierarchical if-then-else branches, avoiding sparse, empty columns when divergent paths evaluate completely different properties.
- Rule delegation enables business users and managers to adjust production rules directly within App Studio or the User Portal, backed by automated conflict and completeness checking tools in Dev Studio.
5.2 Decision Tables & Decision Trees
Enterprise case lifecycles require constant decision-making: evaluating customer credit risk, determining loan interest rates, routing insurance claims to specialized adjusters, or calculating promotional discounts. Hardcoding business logic into procedural code or monolithic scripts introduces technical debt, slows down change management, and makes business policy opaque to stakeholders.
Pega Platform provides a dedicated suite of declarative decision rules that externalize and automate decision logic. By modeling business rules as standalone, modular assets, architects ensure logic is reusable across case types, testable via automated unit tests, and delegable to business operations.
1. Automated Decision Rules: When vs. Decision Table vs. Decision Tree
Pega provides three primary decision rule types. Selecting the appropriate rule type is a fundamental architectural competency tested on the CSA exam.
+-------------------------------------------------------------------------+
| PEGA DECISION RULE TAXONOMY |
+-------------------------------------------------------------------------+
| [1] WHEN RULE (Rule-Obj-When) |
| - Binary logic: Returns TRUE or FALSE |
| - Best for simple condition gates, UI visibility, and stage skips |
+-------------------------------------------------------------------------+
| [2] DECISION TABLE (Rule-Declare-DecisionTable) |
| - Tabular matrix: Conditions (Columns) x Values (Rows) |
| - Returns a value or populates properties |
| - Best for structured, multi-variable policy grids |
+-------------------------------------------------------------------------+
| [3] DECISION TREE (Rule-Declare-DecisionTree) |
| - Hierarchical tree: Nested If-Else-If outline |
| - Returns a value or populates properties |
| - Best for asymmetric branching with divergent property checks |
+-------------------------------------------------------------------------+
Decision Selection Criteria
- Choose a When Rule (
Rule-Obj-When) when evaluating a straightforward conditional check that answers a single boolean question: "Is the order total greater than $1,000?" or "Does the customer hold a Platinum membership?" - Choose a Decision Table (
Rule-Declare-DecisionTable) when the business logic evaluates the same set of input properties across a matrix of multiple combinations to return a specific outcome: "Given Credit Tier and Loan Amount, what is the Interest Rate?" - Choose a Decision Tree (
Rule-Declare-DecisionTree) when the logic involves nested, conditional branching where subsequent conditions evaluate completely different properties depending on earlier outcomes: "If applicant is Corporate, check Revenue and Industry; but if applicant is Individual, check Age and Credit Score."
2. Decision Tables (Rule-Declare-DecisionTable)
A Decision Table represents business logic in a spreadsheet-like grid. It consists of condition columns, action/return columns, decision rows, and an Otherwise fallback row.
+---------------------------------------------------------------------------------------+
| DECISION TABLE GRID |
+------------------------------------+--------------------------+-----------------------+
| Conditions (Input Properties) | Actions / Return Values | Row Description |
| .CustomerTier | .SpendAmount | Return Value (pyResult) | |
+-------------------+----------------+--------------------------+-----------------------+
| "Gold" | >= 10000 | 0.25 | VIP Tier High Spend |
| "Gold" | < 10000 | 0.15 | VIP Tier Base Spend |
| "Silver" | >= 5000 | 0.10 | Preferred Customer |
| "Bronze" | [1000..5000) | 0.05 | Standard Discount |
+-------------------+----------------+--------------------------+-----------------------+
| Otherwise | 0.00 | Default / No Discount |
+------------------------------------+--------------------------+-----------------------+
Grid Architecture & Components
- Condition Columns: Each column specifies an input property to evaluate (e.g.,
.CustomerTier,.SpendAmount) and a comparison operator (=,<,<=,>,>=,!=). - Action / Return Columns: Defines the output generated when a row evaluates to true. A table can return a single value (populating
pyResult) or assign values directly to multiple clipboard properties. - Evaluation Rows: Each row contains criteria corresponding to each condition column. For a row to be true, all conditions within that row must be satisfied (logical
ANDacross columns). - The
OtherwiseRow: Placed at the bottom of the table, this row defines the default return value if none of the preceding condition rows evaluate to true. Every well-designed decision table must account for the Otherwise path to ensure deterministic execution.
Comparison Operators and Value Syntax
Decision tables support flexible matching expressions within condition cells:
- Exact Equality:
"Gold","CA",500. - Numeric and Date Ranges:
[10..50](inclusive: 10 through 50),(10..50)(exclusive: 11 through 49),[10..50)(inclusive min, exclusive max). - List / Value Set Membership:
"CA", "NY", "TX"(evaluates to true if the property matches any value in the comma-delimited list; logicalOR). - Wildcard / Any Value: Leaving a cell completely blank signifies Any or wildcard. The condition for that specific column is ignored for that row.
Evaluation Modes: Stop on First Match vs. Evaluate All Rows
In Dev Studio, on the Results tab of the Decision Table, architects configure how rows are processed:
- Stop on first true match (Default):
- Evaluation proceeds sequentially from Row 1 downwards.
- As soon as the engine finds a row where all conditions are satisfied, it executes the action, returns the value, and immediately halts evaluation.
- Row Order is Critical: More specific or restrictive conditions must be placed above broader, general conditions. If a broader condition is placed first, it will "shadow" and permanently block more specific conditions below it.
- Evaluate all rows:
- The engine evaluates every row in the table from top to bottom, regardless of whether earlier rows were true.
- Used when a table performs multiple property assignments or accumulates actions across different criteria (e.g., assessing multiple non-exclusive risk surcharges).
3. Decision Trees (Rule-Declare-DecisionTree)
A Decision Tree structures business logic into a hierarchical outline format consisting of nested if-else-if condition branches.
Decision Tree: DetermineUnderwritingQueue
├── If .ApplicantType == "Commercial"
│ ├── If .AnnualRevenue > 10000000
│ │ └── Return "ExecutiveCommercialQueue"
│ └── Else If .YearsInBusiness >= 3
│ └── Return "StandardCommercialQueue"
│ └── Otherwise
│ └── Return "HighRiskCommercialQueue"
└── Else If .ApplicantType == "Individual"
├── If .CreditScore >= 720 AND .DebtToIncomeRatio < 0.36
│ └── Return "FastTrackConsumerQueue"
└── Otherwise
└── Return "ManualConsumerReviewQueue"
└── Otherwise
└── Return "TriageQueue"
When to Select a Decision Tree over a Decision Table
While Decision Tables and Decision Trees can often solve similar problems, Decision Trees excel in specific structural contexts:
- Asymmetric Condition Paths: In the example above, the commercial branch tests
.AnnualRevenueand.YearsInBusiness, while the individual branch tests.CreditScoreand.DebtToIncomeRatio. If modeled as a Decision Table, the grid would require four separate condition columns, with half of the cells permanently blank for every row, resulting in a sparse, confusing matrix. - Deeply Nested Business Hierarchies: When business decisions mirror organizational flowcharts where subsequent decisions are valid only if preceding branches evaluated to a specific outcome.
4. Architectural Comparison Matrix
| Architectural Attribute | When Rule (Rule-Obj-When) | Decision Table (Rule-Declare-DecisionTable) | Decision Tree (Rule-Declare-DecisionTree) |
|---|---|---|---|
| Output Type | Boolean (true or false) | Returned value (pyResult) or property assignments | Returned value (pyResult) or property assignments |
| Structural Format | Logic condition builder (A AND B OR C) | Two-dimensional spreadsheet grid (Rows x Columns) | Hierarchical nested outline (If-Else-If tree) |
| Best Condition Type | Simple binary conditions or boolean gates | Uniform, orthogonal conditions across same variables | Asymmetric conditions across divergent variables |
| Business User Maintainability | Moderate; typically developer-focused | High; easily understood by business managers | Moderate; outline can become complex if deeply nested |
| App Studio & Portal Delegation | Supported for simple rule variants | Primary rule type for business delegation | Fully delegable to business operations |
| Typical Invocation Points | Flow Decision shapes, Stage Skips, UI Visibility | Flows, Declare Expressions, Router rules, Data Transforms | Flows, Declare Expressions, Routing logic |
5. Rule Delegation to Business Users
One of Pega's most powerful enterprise capabilities is Rule Delegation. Rather than submitting change requests to IT whenever pricing matrices, interest rates, or eligibility criteria shift, organizations empower operational managers to maintain decision rules directly in production.
+-------------------------------------------------------------------------+
| RULE DELEGATION ARCHITECTURE |
+-------------------------------------------------------------------------+
| 1. System Architect configures Decision Table in Dev Studio |
| 2. Rule is placed in an unlocked PRODUCTION RULESET |
| 3. Production Ruleset is assigned to Business Manager's Access Group |
| 4. Architect selects: Actions -> Delegate |
| 5. Manager edits Decision Table directly in App Studio or User Portal |
+-------------------------------------------------------------------------+
Technical Prerequisites for Rule Delegation
To delegate a decision rule safely without compromising enterprise governance, three architectural requirements must be satisfied:
- Unlocked Production Ruleset: In a production environment, core application rulesets are locked against modification. Delegated rules must reside in a dedicated ruleset designated as a Production Ruleset on the Application rule form.
- Access Group Configuration: The Production Ruleset must be explicitly listed under the Production Rulesets array in the Access Group assigned to the business managers.
- Delegation Execution: A developer opens the decision rule in Dev Studio, clicks Actions $\rightarrow$ Delegate, and provides business-friendly instructions and display labels.
Business Manager Experience
Once delegated, business managers access the rule via App Studio or their operational User Portal (under Configurations or Case Settings). The interface renders a simplified, business-friendly table editor. Managers can add rows, alter numeric thresholds, modify discount percentages, and save changes immediately into production without requiring a developer release pipeline or deployment cycle.
6. Decision Rule Conflict & Completeness Checking
To prevent logic errors during authoring, Dev Studio provides automated validation tools accessible from the Decision Table and Decision Tree toolbars:
1. Check Conflicts (Check Conflicts Button)
- Analyzes the rule to detect unreachable rows or duplicate criteria.
- For example, if Row 1 specifies
.LoanAmount > 100000returning"Standard", and Row 3 specifies.LoanAmount > 250000returning"Premium", the Check Conflicts tool flags Row 3 as unreachable under Stop on first true match, because every value exceeding 250,000 will satisfy Row 1 first. - Resolving conflicts requires reordering rows so that more restrictive conditions appear above broader ones.
2. Show Completeness (Show Completeness Button)
- Evaluates the mathematical permutations of all condition column values to detect unhandled data gaps.
- Highlights combinations of inputs that currently fall through to the Otherwise row without explicit business handling.
- Helps architects and business analysts verify that no edge cases are overlooked.
A global commercial lending application must determine the approval authority level for loan applications. If the applicant is a commercial business entity, the decision depends on Annual Revenue, Number of Employees, and Commercial Property Value. However, if the applicant is an individual consumer, the decision depends on Debt-to-Income Ratio, FICO Credit Score, and Employment Tenure. The properties evaluated for commercial entities have no relevance or presence for individual consumers. Which decision rule type should the architect select to model this logic most efficiently and why?
A developer configures a Decision Table to evaluate customer discount percentages based on the property .TotalSpend. The table is set to 'Stop on first true match'. Row 1 specifies .TotalSpend > 10000 with a 15% discount. Row 2 specifies .TotalSpend > 50000 with a 25% discount. During unit testing, a customer with a total spend of $75,000 receives only a 15% discount instead of the expected 25% discount. What is the cause of this defect, and what tool in Dev Studio helps identify this issue during rule authoring?
An operations director requests the ability for regional branch managers to update monthly loan interest rate discount tables directly within App Studio or the User Portal without submitting change requests to the IT engineering team or requiring a new application release. What architectural configuration is required to delegate the Decision Table to branch managers safely and correctly?