Tom Muck

Alpha Dog Blues Band
Home page
All articles
All Extensions | Extension News | Extension FAQs | Customer Login
Books authored or co-authored by Tom Muck
Extensions, books, and other products | Customer Login
Your current cart contents
Tom-Muck.com Blog | CMXTraneous Blog | Flash Remoting Blog
About the site

Simulated Nested Region

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.

Download extension

This extension works in DW MX and higher ONLY in ASP/VBScript, ASP/JScript, PHP_MySQL, ColdFusion, and JSP. For an UltraDev version go to Basic-UltraDev.

Pay me securely with your Visa, MasterCard, Discover, or American Express card through PayPal!
Pay me securely with your Visa, MasterCard, Discover, or American Express card through PayPal!
About | Privacy Policy | Contact | License Agreement | ©2002-2024 Tom Muck | Dreamweaver Extensions