Back Forward Data Transform form
Completing the Definition tab — For Each Page In and Exit For Each actions

Usage

Use the For Each Page In action to have the system apply the subsequent actions to every page in a target Page List or Page Group mode property. After the For Each Page In action row, the system goes down the subsequent children rows and iteratively applies the actions in those rows to each page in the target.

Use the Exit For Each action to stop the iterations of the For Each Page In action. Actions at the same level as the Exit For Each row (its siblings) are not performed by the system.

The Exit For Each action is typically used as part of an overall conditional structure. For example, in the following shopping cart example, Items is a Page List property. if the user adds a product item (.PRODUCTNAME) and quantity to his shopping cart, the When action checks to see if that product is already in the cart, for each page of Items and if so, updates the quantity in the shopping cart with the additional quantity for that item. After the item is found in the cart, the Exit For Each action stops the system from iterating over the rest of the pages in Items and omits the actions for the Otherwise case (which are not needed once the item is found to exist in the cart).

For Each Page In pyWorkPage.Items
  When .Name == Primary.PRODUCTNAME
    Set pyWorkPage.ItemToAdd.LocationFound equal to pyWorkPage.Items(<CURRENT>).pxListSubscript
    Set pyWorkPage.ItemToAdd.Found equal to "true"
    Set pyWorkPage.ItemToAdd.Quantity equal to pyWorkpage.Items(<CURRENT>).Quantity
    Exit For Each
  Otherwise
    Set pyWorkPage.ItemToAdd.Found equal to "false"

Example

For Each Page In .Customers
  When IsPreferred
    Set Discount equal to 15
  Otherwise When IsExisting
    Set Discount equal to 5

Relationship settings

The For Each Page In and Exit For Each actions have no settings for the Relation field.

Supported features

You can use the following items in the For Each Page In action:

Restrictions

You cannot use Page List properties that have Lightweight specified in their rule forms as sources. See Property form — Completing the General tab — Page modes for a description of the Lightweight option.

You cannot iterate over a source. You can only iterate over target pages.

You cannot use the <APPEND> keyword in the For Each Page In action. Instead, follow the For Each Page action with an Append to action or Append and Map to action.

Up About Data Transforms