More about Decision Tables
Use a decision table to derive a value that has one of a few possible outcomes, where each outcome can be detected by a test condition. A decision table lists two or more rows, each containing test conditions, optional actions, and a result.
Uploading an Excel spreadsheet to start
If you have in advance a Microsoft Excel spreadsheet in XLS file format that contains useful starting information for a decision table, you can incorporate (or "harvest") the XLS file and the information it contains directly into the decision table.
This feature lets people with no access to the Pega Platform record their decision rules using a familiar software program.
Evaluating a decision table
In an activity, to evaluate a decision table and derive a value, your application can:
- Use the Property-Map-DecisionTable method
- Call the standard function DecisionTable.ObtainValue()
- Call the standard activity @baseclass.DecisionTableLookup
Method
In an activity, call the method Property-Map-DecisionTable method. As parameters, enter the target property name and the name of the decision table.
Standard function
In an activity, call the standard function named DecisionTable.ObtainValue to evaluate a decision table. Use the syntax:
Lib(Pega-RULES:DecisionTable).ObtainValue(this, myStepPage, "decisiontablename")
Performance
The Pega Platform does not limit the number of rows in a decision table. However, as a best practice to avoid slow performance when updating the form and also avoid the Java 64KB code maximum, limit your decision tables to no more than 300 to 500 rows.
Standard activity
The standard activity named @baseclass.DecisionTableLookup also evaluates a decision table. (This approach is deprecated.)
You can view the generated Java code of a rule by clicking
. You can use this code to debug your application or to examine how rules are implemented.Special processing with Declare Expression calls
When a Declare Expression rule has
Result of decision table
for the Set
Property To field, special processing occurs at runtime when a property referenced in the
decision table is not present on the clipboard. Ordinarily such decision rules fail with an
error message; in this case the Otherwise value is returned instead. For details, see the
Pega Community
article
Troubleshooting: Declarative Expression does not execute
when a decision rule provides no return value.
Not declarative
Despite the class name, the Rule-Declare-DecisionTable rule type does not produce forward or backward chaining. Technically, it is not a declarative rule type.