Activity form
|
The icon on the Steps tab identifies the iteration column. Use iterations
to repeat a step or a contiguous sequence of steps a number of times, or
until a condition is met. You can iterate over the elements in an
aggregate property — a Value List
, Value
Group
, Page List
, or Page Group
.
This feature provides a limited form of enumeration or looping, similar to the "repeat until" or "do while" or "repeat from X to Y" structures of programming languages.
In a child step within a multistep iteration, right-click to access a context menu. You can copy, cut, or paste child steps within the same iteration.
Repeating a single step using the iteration box
When a step row is not selected, a indicates that this step is iterated. When a step row is selected, clickto add an iteration or theto access the details of the iteration. Use this selection box to indicate whether and how to repeat the step. You can cause the step to repeat a specific number of times, or until a specific result is reached.
Use the Iteration Box to apply the step to more than one page or object. Select:
For Each Page
For Each Embedded Page
For Each Element in Value List
For Each Element in Value Group
B-21900For Loop
To exit the iteration before processing all elements in the iteration, complete a transition that is true after the last desired element is processed.
When processing
the For Loop
or iterating over a Value List
or Page List
property, the parameter
param.pyForEachCount
holds the current iteration number.
You can examine (but not alter) this value in the step. For example,
to iterate only over the first ten pages or values, you can exit the
iteration when pyForEachCount
is greater than 10.
PRKB-20114
If the body of the iteration requires more than one step to code, create an activity and call the activity in the iterated step. Select the Pass current parameter page? box to share the parameter page of the current activity with the called activity.
Select the For Each Page
option to sequence through
all pages of a specified class or classes and perform a method or
instruction for each page. Leave the Step Page field
blank. Each time the step repeats, the step's page changes.
VAGUE WHAT DOES IT ITERATE OVER
For the optional Valid Classes parameter, enter a class or classes. (Click the Add Row icon beneath the Valid Classes box to add more than one class.)
When Valid Classes is not blank, iteration processing skips over any page with a class that does not appear on the list, or is not derived from one of these classes.
Use For Each Embedded Page
option to apply a method or
instruction to each embedded page in a Page List
or
Page Group
property. Use the iteration choice to specify
processing that is to occur for each embedded page. For example, you
can:
and so on.
Identify the property containing the embedded pages in the
Step Page field. The SmartPrompt list for the
Step Page field shows only Page List
and
Page Group
properties. GRP-199
For the optional Valid Classes parameter, enter a class or classes. (Click the Add Row icon beneath the Valid Classes box to add more than one class.)
Page
List
or Page Group
are included in the
iteration.For Each Element in a Value List
Select the For Each Element in a Value List
option to
repeat the step for each element in a Value List
property. B-2665
Each time the step repeats, the system applies a method or
instruction of your choice (such as Property-Set) to the current
property. Use the <current>
index value to refer to
the current property element.
When you select this iteration form, a Property
Name field appears. Identify the Value List
property in the Property Name field. GRP-199 V5.5
and OSMAE 12/19/08
For Each Element in a Value Group
Select the For Each Element in a Value Group
option to
repeat the step for each element in a Value Group
property. B-14117 GAGNP 5/27/05 B-21900 disappeared
When you select this iteration form, a Property
Name field appears. Identify the Value Group
property in the Property Name field. GRP-199 V5.5
and OSMAE 12/19/08
Each time the step repeats, the system applies a method or
instruction of your choice to the current property. Use the
<current>
index value to refer to the current
property.
C-1166 04-02 Select the For Loop
option to
repeat the step a number of times determined by the values of integer
constants or integer properties.
Enter integer constant values or integer property references for the Start, Stop, and Increment fields. The Increment must be a positive integer. MIRAT OSMAE 10/23/09
The system accesses these three values once before starting the iteration. The iteration may occur zero, one, or many times, repeating until the incremented value is greater than or equal to the stop value (unless a transition causes processing to end earlier).
B-11881 OLSOK 1/18/05 The symbolic reference
<CURRENT>
may be used only in the activity step
that defines the iteration. If that step calls another activity, the
symbolic reference <CURRENT>
cannot be used in the
called activity; rather, aspects of the current iteration are
available on the parameter page of the called activity:
For Each Element in a Value
List
or For Each Element in a Value Group
, the
symbol <CURRENT>
refers to the value of
ClipboardProperty corresponding to the iteration. For the called
activity, this corresponds to the pyPropertyValue
parameter described below.<CURRENT>
refers to
the index number of the current iteration, and corresponds to the
pyForEachCount
parameter.The scope of an iteration can be more than one step. The iteration type and conditions are set in the first step of a multistep iteration.GRP-199 and TASK-897 SDAS NORIR
To create a multistep iteration:
Page List
or Page
Group
property on the step page of the parent. (In this
case, complete the For Each Embedded Page
iteration
details for the child step.)Numbered child steps are executed in sequence NNN.0, NNN.1, NNN.2 ... then NNN.0 again, until the iteration ends or a transition causes a jump to a labeled step.
To convert an iteration sequence to
comments, enter two slash characters // in the Label
field of the parent step. The parent and all child steps become
comments.
You can't jump from outside a multistep iteration to any step within the iteration (except to the starting — parent — step). You can jump from any step in an iteration (parent or child) to a higher-numbered step (that is not within any iteration).
For an example of multistep and nested iterations, see the Pega Developer Network article PRKB-25610 How to use multistep loops and nested loops in activities.
By using the Add Child Step icon ( ) on a child step numbered NNN.Z, you can create a nested iteration. GRP-199
For example, clicking a child step numbered 14.8 converts this to 14.8.0, and inserts a second-level child step numbered 14.8.1. Complete the iteration conditions for step 14.8.0.
Use care in entering the Step Page for the parent step of a nested iteration (14.8.0 in this example). If you refer to an aggregate property (Value Group, Value List, Page Group or Page List), select a property that reside on the <CURRENT> step page of the parent's parent. (That is, the structure of the iteration must follow the structure of the page).
From within a nested iteration, you can jump (using a transition) to a labeled step that is within an outer iteration but higher numbered. You can jump from 14.8.9 to 14.10 or 17, but not from 14.8.9 to 14.3.
B-11491 If a step is part of an iteration sequence, the method cannot be any of the following:
Connect-Java Obj-Open Obj-Open-By-Handle Obj-Sort
|
Page-Change-Class Page-Merge-Into Page-New Page-Validate RDB-Open |
Parameters available to called activity
Process Commander automatically adds the following parameters to the parameter page of a called activity with a step that contains an iteration.
pyForEachCount
— Index of the current
iteration, normally starting at 1 and incrementing by one. (If the
iteration type is For Loop
, the starting value may be
a value other than 1 and the increment may be a value other than
1.) This parameter is available throughout the iteration as well as in called activities. GENTJ OSMAE 8/20/09pyIterationType
— Indicates the iteration
type, internally represented by one of the constants
page
, embedded
,
propertylist
, propertygroup
, or
repeat
. (This parameter values are not available to other methods
in an iteration step.)pyIterationTarget
— Identifies the name or
reference of the iteration. For page and repeat types, it is blank.
For embedded, it is the step page reference. For
propertylist
or propertygroup
, it is the
property specified in the iteration. (This parameter values are not available to other methods
in an iteration step.) (This parameter values are not available to other methods
in an iteration step.)pyPropertyValue
— Available only for
propertylist
and propertygroup
iterations. The text value of the current property. (This parameter values are not available to other methods
in an iteration step.)pyPropertyReference
— Obsolete. Set to
"???" for backward compatibility.pyPropertyType
— Obsolete. Set to
"???" for backward compatibility.