Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Master Record Set in A - Z Grid

Guest
Aug 08, 2007 Aug 08, 2007
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
TOPICS
Server side applications
372
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 08, 2007 Aug 08, 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/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 08, 2007 Aug 08, 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


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 08, 2007 Aug 08, 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 09, 2007 Aug 09, 2007
Basically follow David's instructions. The SQL for MySQL and Access is the
same. Set up a recordset with:

SELECT DISTINCT LEFT(field, 1) AS letter
FROM mytable ORDER BY LEFT(field, 1)

Then add a link to your page:

<a href="mypage.asp?letter=<%=(Recordset1.Fields.Item("letter").Value)%>">
<%=(Recordset1.Fields.Item("letter").Value)%></a>

Then put a repeat region around it.

That gives you a list of links.

Then use the url parameter "letter" to filter the second recordset


--
--
Tom Muck, Adobe Community Expert
Dreamweaver Extensions/Articles -- http://www.tom-muck.com/
Cartweaver Development Team - http://www.cartweaver.com/
Extending Knowledge Daily - http://www.communitymx.com/

"LJG" <webforumsuser@macromedia.com> wrote in message
news:f9dij1$7i$1@forums.macromedia.com...
> 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
>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 10, 2007 Aug 10, 2007
LATEST
Hi Guys,

Yes sorry I have completed this...it was late at night when I was reading the message after a very long day....clarity was not good...many thanks for your help.

I am still intrested in being able to slect from a drop down box, so if you know how I could do this I would be most grateful

Regards
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines