Skip to main content
Verify the version tags to ensure you are consuming the intended content or, complete the latest version.

Decision tables

If you are asking a yes/no question when using an automated decision process, such as "Does this purchase order require additional approval?", then a when rule serves the purpose. However, if you need to test the values of multiple properties to answer questions, such as “What promotional offer should the company offer?”, you can use a decision table.

For example, you can configure a decision table to determine the discount for customers at different spending thresholds. Using the decision table, customers who purchased more than USD1,000 in the previous year and have been a customer for five or more years are entitled to a 20 percent discount for purchases greater than USD50. Customers who purchase more than USD1,000 but have been a customer for less than five years are entitled to a 15 percent discount on purchases greater than USD100. Customers who do not meet either condition are not entitled to a discount.

example of a decision table

The following video describes the structure of a decision table and how decision tables evaluate information.

Video transcript

A decision table consists of a table of conditions and results. You define a set of conditions – for example, property values that must fall within a certain range – and the results to return when the conditions are true. Each set of conditions contains a corresponding result. You can add columns for each condition you want to test against – either a property reference or an expression – and rows for each combination of conditions you want to test.

When the system evaluates a decision table, it starts with the top row and evaluates each condition in the row. If all of the conditions are true, the system returns the result for that row. If not, it advances to the next row, and evaluates the conditions in that row. And if none of the combinations returns a result, the system returns the otherwise result at the bottom of the table. This ensures that the decision always returns a result.

Check your knowledge with the following interaction:

Decision table logic

Decision tables are a good approach when you use a set of properties or expressions to arrive at a decision.

In the following example, a banking application uses a decision table for determining monthly maintenance fees. To find the correct fee, the decision table compares the account type and customer type property values on the table to the input values.

The table has rows for evaluating the correct fee for each combination. For instance, if the account type equals "Checking", and the customer type equals "Basic", then the system returns a value of USD10.

The following example shows how the decision evaluation works based on the account type and customer type property values.

Decision table

By default, a condition uses an equal comparison operator (as configured in the previous example). If you are using numeric conditions, you can also specify greater than or less than comparison operators. For example, you can create a condition so that if the savings account balance is greater than USD1,000, then a customer is not charged any fees. You can also use value ranges to define the comparison. For instance, if the savings account balance is greater than USD500 but less than USD1,000, the customer can only be charged a checking account fee.

Decision tables in App Studio

You can configure calculated fields using out-of-the-box basic functions and simple custom expressions in App Studio. For example, in an online grocery application, you can use an expression to multiply the quantity by the unit price to calculate the total cost of an item.

For complex calculations which involve multiple conditions with varying results based on the conditions, you can configure a calculated field that references an existing or custom decision table.

Note:  Complex decision tables that are pre-configured in Dev Studio and marked as relevant records are available in App Studio for citizen developers to use.

Consider the example of a YPlus cargo courier company that charges a USD500 delivery charge for courier services. YPlus has decided to update the delivery charge calculation based on distance. Suppose the delivery address is within 100 miles. In that case, the delivery charge is USD50. If the address is within 500 miles, the delivery charge is USD100. If the address is within 1000 miles, the delivery charge is USD250, and if the delivery address is farther than 1000 miles, the delivery charge is USD500. You configure a calculated field that references the decision table described below to determine the delivery charge.

In the following image, click the + icons to understand how to configure a decision table to achieve the desired behavior in the courier company example.

Check your knowledge with the following interaction:


This Topic is available in the following Module:

If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

100% found this content useful

Want to help us improve this content?

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

Pega Academy 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