Assert directive

Use the Assert directive to improve processing efficiency when displaying the results of the Obj-List method in an HTML form.

JSP equivalent

The pega:assert JavaServer Page tag provides a functionally identical capability. See JSP Tags — assert.

Summary

In an activity that uses the Obj-List method, you identify the concrete classes for the Page List property that holds the results from the method. However, when you display the Page List in an HTML display, the system has no way — other than the Assert directive — to indicate in the HTML which classes are involved.

Accordingly, at runtime the system rechecks the class of each page in the list. The assert directive provides a way to indicate in the HTML which classes to use for each page.

If you're working with a class group, use the {elseassert} option for each class in the class group. In addition, use a final {elseassert} option to display something when the system doesn't find anything in any of the classes listed. In some situations, someone might add a class to a class group and neglect to update the Assert directive in HTML forms. In such cases, the {elseassert} option can be important for debugging.

Complete syntax

In the syntax presentations below:

{ASSERT class [=] class-name}
 insert content

 {elseassert class [=] class-name2}
 insert content

 {elseassert}
 insert default content

{END}

Example

For example, in a worklist, the data belongs to a page of class Code-Pega-List. Each pxResults page is limited to one or a few classes. The Assert directive reduces the number of rules the system reads to generate the display.

{foreach in .pxResults}
 {with embeddedpage $this}
  {assert class Assign-Worklist}
   insert row definition

  {endassert}
 {endwith}
{endforeach}

You can assess the benefits of the Assert directive by using the Performance tool to compare the Rule Count number when the directive is used with the number when it is not used.

Directives