<foreach property="P1" key="K1"> ... </foreach>
|Attribute or Element||Description||Value|
|property attribute||Required. The collection property (list or array) to iterate over. It must be the name of a valid object and property in the execution context.||A string of one or more characters.|
|key attribute||Required. The index used to iterate through the collection. It must be a name of a valid object and property in the execution context. It is assigned a value for each element in the collection.||A string of one or more characters.|
|name, disabled, xpos, ypos, xend, yend attributes||See “Common Attributes and Elements.”|
|Other elements||Optional. <foreach> may contain zero or more of the following elements in any combination: <alert>, <assign>, <branch>, <break>, <call>, <code>, <continue>, <delay>, <empty>, <flow>, <foreach>, <if>, <label>, <milestone>, <reply>, <rule>, <scope>, <sequence>, <sql>, <switch>, <sync>, <throw>, <trace>, <transform>, <until>, <while>, <xpath>, or <xslt>.|
The <foreach> element defines a sequence of activities that are executed iteratively, once for every element within a specified collection property. For example:
<foreach property="callrequest.Location" key="context.K1"> <assign property="total" value="context.total+context.prices.GetAt(context.K1)"/> </foreach>
The <foreach> element can refer to the following variables and their properties. Do not use variables not listed here.
|context||The context object is a general-purpose data container for the business process. context has no automatic definition. To define properties of this object, use the <context> element. That done, you may refer to these properties anywhere inside the <process> element using dot syntax, as in: context.Balance|
|request||The request object contains any properties of the original request message object that caused this business process to be instantiated. You may refer to request properties anywhere inside the <process> element using dot syntax, as in: request.UserID|
|response||The response object contains any properties that are required to build the final response message object to be returned by the business process. You may refer to response properties anywhere inside the <process> element using dot syntax, as in: response.IsApproved. Use the <assign> element to assign values to these properties.|
There is more information about the business process execution context in documentation of the <assign> element.