Back ForwardForeach directive

About directives

Use the Foreach directive to repeat an action for each property in a page, for each page in a Page List, or for each property in any list or group. Properties that have a mode other than Single Value are known as aggregates. The Foreach directive iterates through the parts of an aggregate property.

For example, assume a clipboard page named Operators contains embedded pxResults() pages. These pages each hold a property pyUserIdentifier identifying one customer. Use the Foreach directive to create an HTML table that contains a row for each customer. For example:

<TABLE>
  {foreach Operators.pxResults}
     <TR>
       <TD>{$THIS.pyUserIdentifier}</TD>
     </TR>
  {endforeach}
</TABLE>

JSP Equivalent

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

Complete syntax