Mashups in EMML : Writing Mashups in EMML : Controlling Mashup Processing Flow : <foreach>
<foreach>
 
<fuse>
<foreach> Examples
This looping statement processes any children statements in either a repeated loop or in parallel for each node in a node set. The node set is defined in an XPath expression.
You can use most EMML statements within <foreach>. You can also use <break> within this statement to forceably stop loop processing.
For examples, see <foreach> as Sequential Loops, <foreach> as Parallel Loops for All Nodes or <foreach> as Parallel Loops for Any One Node. See also Working Samples for information on sample mashups that use this statement.
Can Contain
( Statements Group | ( Variables Group ) | ( presto:beginTransaction | presto:commitTransaction | presto:rollbackTransaction ) | ( ( macro:custom-macro-name | any element in a non-EMML namespace )* ) | ( break ) | ( variables ) | fuse )+
Allowed In
mashup | catch | else | elseif | for | foreach | if | macro | operation | sequence | try | while
Attributes
Name
Required
Description
variable
yes
The name for the variable to hold each 'item' for this looping statement. The scope for this variable is limited to the <foreach> loop.
items
yes
An XPath 2.0 expression that defines the set of nodes (or sequence) to loop through. The length of this set defines the limit for looping and typically also defines a context for relative expressions used in statements or content within the <foreach> loop.
parallel
Determines whether each loop is processed sequentially (the default) or concurrently (parallel="yes").
Valid values include:
*yes = Process each loop concurrently.
*no = Process each loop sequentially. This is the default.
tasks
Determines how many loops are processed when loops are processed concurrently (parallel="yes"). This can be all loops or any one loop (the first loop to complete ends all loop processing).
Valid values include:
*InvokeAll = Process all loops.
*invokeAll = Process all loops.
*invokeall = Process all loops.
*InvokeAny = The completion of any one loop ends loop processing.
*invokeAny = The completion of any one loop ends loop processing.
*invokeany = The completion of any one loop ends loop processing.
merge
Determines how the results from multiple concurrent loops are fused into one or more variables:
*true = the single output variable defined in <fuse> holds all the results of concurrent loops "by value".
*false = the output variable defined in <fuse> holds a structure that references iterative variables containing the results of each concurrent loop - results "by reference". The output variable name is the base name used for iterative variables, such as $summary (the output variable), $summary1 (one loop's results), $summary2 and so on.
This attribute is only meaningful when parallel="yes" and tasks="invokeall".
The order in which concurrent loops are assigned or fused in variables is not determinant.
timeout
Determines a timeout period, in seconds, for each thread when loops are processed concurrently (parallel="yes").
Copyright © 2013-2015 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback