Simulated Nested Repeat Region

Nested repeat regions are commonly needed in a Web page that serves dynamic content from a database. There are many ways to program a nested region, from nesting loops to data shaping using ADO. All of them require some pretty complex hand-coding. There is an easier way, however. This server behavior takes advantage of some simple conditional logic to simulate a nested repeat region.

What is a nested region?

A nested region is simply a way to display data whereby the data is grouped by certain criteria, such as by category. For example, a listing of books or movies might have several titles in each specific category. If you want to display these titles by category but only display one category, you will want to create a nested region:

Comedy

Monty Python and the Holy Grail
  Blazing Saddles
  Animal House

Horror

Dracula
  Frankenstein

Action

Enter the Dragon
  The Crow
  The Matrix

To apply this server behavior, you'll need to follow these steps:

  1. Add a recordset to your page that has an ORDER BY clause in it that orders your resultset by the "outer repeat" column, or the category column of your recordset. For the above example we used:

SELECT Title, Category from MoviesView ORDER BY category

  1. Next, add your data to the page as you would normally and add your standard repeat region.

  1. Next, highlight the area on the page that you want to show only once per iteration of the loop. In the above example, the repeat region went around the table row that contained the category and title fields. I highlighted the category field by itself and applied the new Simulated Nested Repeat extension to the field.

  1. Choose the recordset name and the column name and click OK. If you browse the page now, the nested region should be working properly. The outer column is shown only once.

This extension works in DWMX ONLY in ASP/VBScript, ASP/JScript, PHP_MySQL, PHP_ADODB, ColdFusion, and UD4-ColdFusion. For an UltraDev version go to Basic-UltraDev.

The extension works with the Recordset Navigation Suite and Dynamic Search Suite.

Download now.

Tom Muck
tommuck@basic-drumbeat.com

Tom Muck

www.dwteam.com

 

 

Copyright © 2002, DWTeam.com. All Rights Reserved.