<rw:foreach>
The rw:foreach
tag loops through the data source group object
specified in the src
attribute. It creates a group cursor for the
data source group and moves the cursor to next instance in each iteration. Within
the rw:foreach
tag body, the rw:field
tag can be used to retrieve data from the current group instance. Embedded rw:foreach
tags try to create related group cursors if they are related, otherwise independent
cursors are created.
Note: The tag body is required and evaluated in each iteration.
<rw:foreach id="cursor_id" src="group_name" [startRow="start_rowno"] [endRow="end_rowno"] [increment="step"]>
[tag body]
</rw:foreach>
Attribute Value |
Description |
|
A unique identifier in the page scope. |
group_name |
The name of a multivalue |
start_rowno |
(Optional) The number of the first row that is to be accessed. The row
number in the first iteration is 1. The
default value is |
end_rowno |
(Optional) The number of the last row to be accessed. The default
value is |
step |
(Optional) The size of the step for the loop. The default
value is |
This example shows using the rw:foreach
tag to loop through data.
<rw:foreach id="R_G_EMP_NAME_1" src="G_EMP_NAME">
<tr bgcolor="<rw:seqval ref="bgcolor" op="nextval"/>">
<td headers="<%= idEmpName %>"> <rw:getValue id="myEmpName" src="EMP_NAME"/><%= myEmpName %></td>
<td headers="<%= idEmpId %>"> <rw:field id="F_EMPLOYEE_ID" src="EMPLOYEE_ID"> F_EMPLOYEE_ID </rw:field></td>
<td headers="<%= idHireDate %>"> <rw:field id="F_HIRE_DATE" src="HIRE_DATE"> F_HIRE_DATE </rw:field></td>
<td headers="<%= idSalary %>"> <rw:field id="F_SALARY" src="SALARY"> F_SALARY </rw:field></td>
<td headers="<%= idCommision %>"> <rw:field id="F_COMM_PCT" src="COMMISSION_PCT"> F_COMM_PCT </rw:field></td>
<td headers="<%= idManager %>"> <rw:field id="F_EMPLOYEE_ID1" src="EMPLOYEE_ID1"> F_EMPLOYEE_ID </rw:field></td>
<td headers="<%= idTotal %>"> <rw:field id="F_TotalSALARY" src="TotalSALARYPerEMPLOYEE_ID"
formatMask="%NNNNN.00"> F_TotalSALARY </rw:field></td>
</tr>
</rw:foreach>