Back Forward Declare Expression rules
Completing the New or Save As form

About Declare Expression rules

Create a Declare Expression rule by selecting Declare Expression from the Decision category.

NoteIf at runtime the Target Property resides on an embedded page rather than a top-level page, complete the Page Context key part before completing the Target Property key part.

C-460 04-01 A Declare Expression rule has three key parts:

Field

Description

Applies To

SmartPromptSelect an internal or external class for this rule. C-1854 The properties to be calculated can be in this class or in the class of an embedded page.

If you select a class derived from the Embed- base class, leave the Page Context key part blank, which creates a context-free expression. BUG-4001 GAJNJ 4/10/07

Note You cannot use a Rule-Declare-* class or any ancestor of the Rule-Declare- class (including @baseclass) here. R-8041 7/03 B-1076 You cannot use a class derived from the Code-or Embed- class here. BUG-4001 GAJNJ 4/10/07 Embed is allowed

NoteYou can't create rules with Work- as the Applies To class. Instead, choose a class derived from Work-, such as a work type or work pool container class. In many cases, the Save As dialog box defaults a container class for this field. See Copying standard rules from the Work- class.

Target Property

SmartPromptSelect a property that appears somewhere within the scope of the class in the Applies To key part. Precede the name with a period. Select a property of mode Single Value, Page, or B-10365 MIRAT Java Property.

You can't use a Declare Expression rule to compute a property for which the Cannot be declarative target box (on the Advanced tab) is selected.

NoteYou can't use symbolic page names such as primary or steppage here, because they are meaningful only in an activity execution context. B-18915 B-17388

Page Context

SmartPromptOptional. Leave this blank if the Target Property property has mode Single Value and appears directly on a page of the Applies To class, or if you are creating a context-free expression.

Otherwise, identify a Page List or Page Group property reference plus parentheses, GAJNJ 4/21/10 starting with a period. B-20028 B-20697 Omit any index between parentheses, as the expression applies to all elements. B-17137 no explicit subscripts For example, these show correct use:

.Invoices.pyOrders().pyItems().pyItemNames()

.pxCorrSummary()

NoteThe length of the value in this field is limited to 64 characters. SR-1513 MIRAT B-17116

NoteForward chaining does not create embedded pages where none existed before. Declare Expressions that have a non-blank Page Context and that use top or parent keywords do not execute unless there is at least one pre-existing embedded page at each level of the page context. For more information and an example, see Pega Developer Network article PDNPRKB-21038 Declare expression rules using the TOP or PARENT keyword depend on existing pages to run.

Advanced featureWhen a property is the target of two Declare Expression rules — one context free and the second with a context, the second takes precedence over the context free rule, which is ignored. If two context free Declare Expression rules reference the same property using distinct property reference forms (for example workpage.targetproperty and .targetproperty), the rule with the longer reference is executed; the rule with the shorter reference is ignored. ERNSG 8/17/09

For general information on the New form, see Completing the new rule dialog box. For general information on the Save As form, see How to enter rule keys using Save As.

Rule resolution

FFTT When searching for Declare Expression rules, the system:

Time-qualified and circumstance-qualified rule resolution features are available for Declare-Expression, Declare-Constraints, and Declare-OnChange rules. v5.4 proj-823

Up About Declare Expression rules