Pega - DECISIONS Interview Q&A

Business logic that changes often should not be buried in activities. Pega gives you decision rules, small rules that hold the logic in a form business people can read and change. There are four you need to know well: the When rule, the decision table, the decision tree and the map value.

The four decision rules

RuleRule typeReturnsBest for
WhenRule-Obj-WhenTrue or falseA single condition on one or more properties
Decision tableRule-Declare-DecisionTableA valueCombinations of conditions laid out in rows
Decision treeRule-Declare-DecisionTreeA valueNested if, then, else logic
Map valueRule-Obj-MapValueA value from a lookup gridRates or codes indexed by one or two inputs

When rule

It evaluates a relationship between property values and gives back true or false. Use it wherever you need a yes or no: a flow branch, a field's visibility, or a step condition.

Decision table

A table has rows, each with test conditions and a result. Pega reads the rows from the top and returns the result of the first row where all the tests are true. A blank cell counts as true, and if no row matches, the otherwise row is returned.

Decision tree

A tree takes one input property but can evaluate many others. Each branch tests a condition and leads to another test or to a result. It is the better choice when the logic is nested, for example "if the customer is a business, then if the turnover is over X, then...".

Map value

A map value is a grid that returns a value for one input (one-dimensional) or a pair of inputs (two-dimensional, using a map value pair). Think of a rate card: age band down the side and term across the top.

How to call them

  • From a decision shape in a flow, to choose a path.
  • From an activity with Property-Map-DecisionTable, Property-Map-DecisionTree or Property-Map-Value, to store the result.
  • From a declare expression, so a property is recalculated automatically.

A worked example

A bank scores loan risk.

Credit scoreIncomeResult
> 750anyLow
> 650> 40,000Medium
otherwiseHigh

A customer with a score of 700 and an income of 50,000 fails the first row, matches the second, and gets Medium. A customer with a score of 600 falls through to otherwise and gets High. To change the thresholds, an analyst edits the table. The activity and flow do not change.

Choosing between them

  • One yes or no test: When.
  • A few conditions side by side: decision table.
  • Nested or step-by-step logic: decision tree.
  • A lookup by band or code: map value.

Interview tip

Name all four with their rule types, then use the loan risk table as your example. Mention that decision rules can be delegated to business users. More: When vs Access When.

No comments:

Post a Comment