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:
- Change Tracking 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 .
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:
and so on. You can also declare that OrderLine().TotalPrice is always equal to .Quantity multiplied by.UnitPrice.
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).
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.
Declare Expression rules are instances of the Rule-Declare-Expressions rule type. They are part of the Decision category.
- Declare Expression form - Completing the Change Tracking tab
Complete this tab to determine the conditions that cause automatic recomputation of the expression. These conditions affect how often the computation on the Expressions tab is performed.
- Declare Expressions form - Completing the Expressions tab
On this tab, record the computations for the target property identified in the key.
- Declare Expression rules - Completing the New or Save As form
Declare Expression rules - Completing the Create, Save As, or Specialization form
- Constraints form - Completing the Pages & Classes tab
Complete this tab to list the pages referenced by name in the Constraints tab, and to identify the context of the properties constrained.
- Viewing generated Java code of Access When rules
- Unit testing a Parse Structured rule
You can test a Parse Structured rule directly, separate from the activity or other context in your application in which it will ultimately operate.