About Declare Expression rules

Use Declare Expression rules to define automatic computations of property values based on expressions.

The following tabs are available on this form:

  • Expressions
  • Change Tracking
    Note: The Change Tracking tab has been removed from the declare expression rule form as of Pega Express 8.3. If you want to use the Change Tracking tab when configuring your declare expression, click Actions > Use legacy expression.
Note: Do not confuse Declare Expression rules with simple expressions. Expressions — a syntax that includes constants, function calls, operators, and property references — are used in many situations in addition to Declare Expression rules.

Forward chaining

Often, target property values are computed automatically each time any of the other input values in the expression change, or when a value for this property is accessed, changed, or using other criteria. This technique is known as forward chaining.

For example, you can declare that a property named Order.TotalPrice is always the sum of:

  • OrderLine(1).TotalPrice
  • OrderLine(2).TotalPrice
  • OrderLine(3).TotalPrice

and so on. You can also declare that OrderLine().TotalPrice is always equal to .Quantity multiplied by.UnitPrice.

Backward chaining

In an activity, the Property-Seek-Value method can access the computational relationships among properties in a Declare Expression rule to identify source values needed to compute a missing property value. This technique is known as backward chaining.

For example, consider a single Declare Expression rule defining Circumference as 3.1416 times Diameter with Change Tracking set to Whenever used. This rule can be used in either forward-chaining or backward-chaining mode:

  • If step 3 of an activity causes the value of Diameter to be set, an updated value for the Circumference property is available at the start of step 4 (forward chaining).
  • If step 1 of another activity uses the Property-Seek-Value method with Circumference as the target, and no value for Circumference is found, the system seeks a value for Diameter (backward chaining).

Access

Use the Application Explorer to access the Declare Expression rules that apply to work types in your application. Use the Records Explorer to list all Declare Expression rules available to you.

After you complete initial development and testing, you can delegate selected rules to line managers or other non-developers. Consider which business changes might require rule updates and if delegation to a user or group of users is appropriate. For more details, see Delegating a rule or data type.

Category

Declare Expression rules are instances of the Rule-Declare-Expressions rule type. They are part of the Decision category.

Note: This rule type name ends with S . The Rule-Declare-Expressions rule type replaces the 03-02 Rule-Declare-Expression class, which is deprecated.