Skip to main content
August 8, 2007
Question

Master Record Set in A - Z Grid

  • August 8, 2007
  • 5 replies
  • 368 views
Hi I am looking to have a grid A - Z so slecting a letter filters the records for just the names of that letter, does anyone know the best way to do this? has anyone done it?

But mainly:
1. How Do I setup the filer on the records page to list only the letter selected?
2. How Do I pass the Letter as a URL string?

Regards
This topic is closed to new replies. Start a new post to keep the conversation going.

5 replies

Inspiring
August 8, 2007
> 1. To create the A-Z list, create a recordset that selects the first
> letter of the column on which you want to base the index. Say it's a list
> of people, you want the first letter of everyone's family name. In MySQL,
> you would use the following as the SQL query:
>
> SELECT DISTINCT LEFT(family_name, 1) AS letter
> FROM my_table

Also ORDER BY LEFT(family_name, 1)

Tom


August 8, 2007
Hi Tom,

Yes thanks for that, sorry, I put the ASPvb part in my signature and have updated it to include MSaccess for the database.

OK, I have created the recordset ok, but not sure how I would add it to the page as a some kind of navigation system? as I cannot sort this right now I cannot move any further, but think I understand what you mean.

If you can advise I would be most grateful.
Regards

Inspiring
August 8, 2007
LJG wrote:
> Hi I am looking to have a grid A - Z so slecting a letter filters the records
> for just the names of that letter, does anyone know the best way to do this?
> has anyone done it?

When asking this sort of question, it's important to say which server
model and database you're using, because the code for each one is
different. However, the principle is the same for all.

1. To create the A-Z list, create a recordset that selects the first
letter of the column on which you want to base the index. Say it's a
list of people, you want the first letter of everyone's family name. In
MySQL, you would use the following as the SQL query:

SELECT DISTINCT LEFT(family_name, 1) AS letter
FROM my_table

Using the LEFT() function with 1 as the second argument gives you the
first letter only of each family name. DISTINCT eliminates duplicate
entries. This produces a recordset of initial letters to build your index.

2. Build the index using the recordset, and create a link to your
display page. Select the Parameters button in the Select File dialog
box, and set the name to "letter", and bind the value to "letter" from
the recordset. This adds a query string to the end of the link in the
form ?letter=m.

3. In your master page, create a recordset using the URL parameter
"letter" as the filter.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/