Advanced Customization > Info*Engine User’s Guide > Info*Engine Custom Tag Reference > Info*Engine Tags > Core Library Tags > forEach
  
forEach
The forEach tag block allows you to iterate through an existing Info*Engine group one element at a time. The result of each iteration produces one element (including all attributes of the element) in the output group specified. This resulting element is only available within the forEach tag block for which it was produced. You can then use this output group as the input group in Info*Engine tags that are nested in the block.
Each time the forEach end tag is reached, the processing loops back to the forEach start tag until there are no more elements in the input group. After all elements have been processed, the last element in the forEach input group is now in the output group (named in the groupOut attribute). Processing continues on to the next line after the forEach end tag.
* 
This tag cannot be nested in other Info*Engine tags, but other Info*Engine tags can be nested under this tag.
Syntax
<ie:forEach groupIn="group_name" groupOut="group_name">
.
. (other Info*Engine tag blocks)
.
</ie:forEach>
Attribute Descriptions
Required Attributes: groupIn and groupOut.
groupIn
Specifies the name of the Info*Engine group to use as input. For each iteration of the loop, the next element (including all attribute values in the element) from the input group is moved to the output group.
This attribute is required.
groupOut
Specifies the name of the Info*Engine group to generate for each iteration.
This attribute is required.
Example
The following example declares that the page uses tags from the Info*Engine core tag library and that the tags have the ie prefix. The example assumes that the “employees” group exists as a result of a “CreateEmployeeGroup” task. The forEach tag block iterates through the “employees” group, one element at time. Nested within the block is the Display-Object webject, which displays the attributes with each element using the caption “One Employee”:
<%@ taglib uri="http://www.ptc.com/infoengine/taglib/core"
prefix="ie" %>

<!-- create input group -->
<ie:task uri="CreateEmployeesGroup"/>

<!-- iterate group, displaying the attributes for one employee -->
<!-- in each iteration -->
<ie:forEach groupIn="employees" groupOut="employee">
<ie:webject name="Display-Object" type="DSP">
<ie:param name="GROUP_IN" data="employee"/>
<ie:param name="CAPTION" data="One Employee"/>
</ie:webject>
</ie:forEach>