context-free expression

A context-free expression rule is a Declare Expression rule that applies to an embedded page or pages and computes the value of a target property in every page of that class that appears on the clipboard, regardless of the name, class or contents of higher-level pages above the embedded page. (In unusual cases, you can define a context-free expression for a top-level page.)

A Declare Expression rule that is not context-free is called context-bound.

Examples

For example, if a computation among properties in a page of class Embed-Rating is always true, regardless of which higher-level objects contain this page, a context-free expression is appropriate.

Similarly, a computation such as Age = CurrentYear - BirthYear is valid regardless of whether the page that contains the three properties (Age, CurrentYear, BirthYear) is at a top level, or embedded in the pages of a page list Policyholder.Children(), or even in a page list PolicyHolder.Children().Children().

Benefits

Using context-free expressions when appropriate can reduce the number of Declare Expression rules you need to build and maintain in your application.

Building a context-free expression

To create a context-free expression:

Performance

By its nature, a context-free expression executes in more contexts than a similar Declare Expression rule that executes only in the context of a specific top-level page name. In some cases, this additional processing can affect system performance.

Two statistics in the Rule Execution Counts area of the Full Details display of the Performance tool let you assess the performance of Declare Expression rules:

Precedence

When 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.

Related Topics IconRelated terms