Skip to main content
LinkedIn
Copied!

Table of Contents

Decision tables

Version:

Only available versions of this content are shown in the dropdown

Decision tables derive values that have one of a few possible outcomes, where each outcome can result from a test of a condition that includes multiple variables. A decision table lists two or more rows, and each row contains test conditions, optional actions, and a result.

Decision tables are appropriate for evaluations that include more elements compared to simple true/false evaluations. For example, you can use a decision table to estimate a car insurance payment based on the age of the driver, age of the car, and the make of the car.

You build decision tables by adding columns and rows. Each column represents a condition, while rows store corresponding values that the system tests at run time. For example, you can build a decision table to determine shipment costs based on the following conditions:

  • The value of the order
  • The weight of the parcel
  • Whether the shipment is to a foreign country

Each condition is a separate column in the decision table. Additionally, every decision table includes a column that stores results that the decision table returns if all values in a row evaluate to true.

Each row includes cells that store values that the system evaluates at run time. You can insert more than one value in a cell by adding an OR condition, and then the system continues processing a row if any of the values in the cell evaluate to true.

At run time, the system evaluates the rows starting at the topmost row:

  • If any condition in a row evaluates to false, processing continues with the next row. The system ignores the Return column for that row.

    You can leave empty cells in a row. Empty cells evaluate to true except when a cell is empty and includes an OR condition. Then, the parser ignores that cell and parses only the cell that contains a value.
  • If all the conditions in a row evaluate to true, the system processes the Actions and Return columns of that row. The next action depends on how you configure your decision table:
    • To return only one result, you can configure processing to end. The system then returns the value in the Return column as the value of the entire rule.

      In scenarios that require only one result, such as estimating delivery costs, when you end processing after receiving the first result, you improve performance and avoid unnecessary computations.

    • To return multiple results, you can configure processing to continue through all remaining rows, performing the Actions and Return calculations for any rows for which the conditions are all true.

      For example, when the decision table returns the email address of a person in a process to approve an expense, the expense might require the approval of more than one person, based on the conditions. Such scenarios require more than one result.

  • If all rows in the table evaluate to false, the system returns a default result.
In the following figure, the decision table calculates the shipment cost in an online shop. The cost depends on the value of the order, the weight of the parcel, and whether the shipment is to a foreign country. If the order value is less than $500, and the parcel weight is less than 3kg, and the shipment is to the same country, then the shipment cost is $20. If any of these values evaluate to false, the system moves to the next row. If all rows evaluate to false, the system returns the default value of $60 for the shipment cost:
Decision table
A decision table that returns shipment costs.

Applying decision tables

You can apply decision tables in the following elements of your application:

  • In a flow rule, you can reference a decision table in a decision shape .

    For more information, see Adding decisions to processes.

  • In an activity, you can evaluate a decision tree by using the Property-Map-DecisionTable method.

    For more information, see Creating an activity.

  • A Declare Expression rule can call a decision table.

    For more information, see Creating Declare Expression rules.

  • A collection rule can call a decision table.

Category

Decision table rules are instances of the Rule-Declare-DecisionTable class. Decision tables are part of the Decision category.

  • Creating decision tables

    To better adjust to the varied factors in your business processes, you can create a decision table. Decision tables test a series of property values to match conditions, so that your application performs a specific action under conditions that you define.

  • Specifying pages and classes of a decision table rule

    To ensure that a decision table accesses or updates information on clipboard pages, specify the page name and class of the pages. At run time, these pages contain the properties that a decision table references on other tabs of its rule form.

  • Configuring additional options for a decision table

    Adjust how your decision table works by configuring additional options. For example, you can configure how a decision table behaves after one row evaluates to true, or define which elements of a decision table are available for edits.

  • Completing the Table tab

    To record the conditions to be tested in each row, complete the Table tab. When all the conditions in the row are true, in the rightmost Return column of each row, enter the result of this decision table.

Did you find this content helpful?

100% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Ready to crush complexity?

Experience the benefits of Pega Community when you log in.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us