|
The Nested Repeat Region Server Behavior:
| The Nested Repeat Region Server Behaviors follow along with the tutorial in Chapter 22 of Dreamweaver UltraDev: The Complete Reference, by Ray West, Tom Muck, and Tom Allen. |
|
To apply the Nested Repeat behavior to the page, you must follow these steps for the sample page:
1. Insert a 2-row, 2-column table into the content region of the page.
2. Apply a standard recordset to the page, using a SQL statement to retrieve the column information for the outer loop. The statement in this case is something like:
SELECT Distinct OuterColumn from MyTable
3. Drag and drop the newly created dynamic column OuterColumn to the first column of the first row. You can set the style of this text to Bold for emphasis.
4. Select both rows of the table. You can do this easily by positioning your cursor in the second row, second column and holding down the mouse button and dragging the mouse across the table, as shown here. Apply a standard Repeat Region to the area, choosing to show 3 records at a time.

5. In the second cell of the first row, position your cursor and insert a RecordsetForNesting Server Behavior. Create a recordset using the OuterColumn column from the first recordset as a parameter. The variable in the recordset should have a run-time value of Recordset1("OuterColumn"). The SQL should look something like this:
SELECT Column1, Column2 FROM mytable
WHERE OuterColumn = 'myVariable'
The variable should be declared something like this:
| Name |
Default Value |
Run-time Value |
Server Model |
| myVariable |
testvalue |
Recordset1("OuterColumn") |
ASP |
| |
|
Recordset1.getString("OuterColumn") |
JSP |
6. In the second row of the table, insert the Column1 column into the first cell of the row and the Column2 column into the second cell of the table.
7. Select the second row of the table and apply the Nested Region Server Behavior. Make sure you choose the correct recordset from the dropdown box (Recordset2).
8. Somewhere below the table you can insert the Recordset Navigation Bar object. It will work on the first recordset and allow you to loop through the OuterColumn values.
After applying these steps you should be able to browse the page and cycle through the records for the OuterColumns. The nested repeat should show the 2 columns for each OuterColumn.
The steps must be followed precisely to allow for the precise placement of the server-side code. If you are having problems, check the order of your code blocks and see if they follow the order shown below:
Outer recordset
Outer repeat region begin loop code
(Display field from outer recordset)
Variable declaration for nested recordset
Nested recordset
INNER Repeat region begin loop code
(Display inner fields)
End inner Repeat
End outer repeat
close inner recordset
close outer recordset
|