Small bug in my code...forgot the anchor name in the link. Change the line
that reads:
<a href="link.cfm##">#t1.init#</a>
to:
<a href="link.cfm###t1.init#">#t1.init#</a>
-----Original Message-----
From: Brian Flynn
Sent: Friday, January 26, 2001 1:45 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Alphabetic List
Here's some code that does it. If you care about what the source looks
like, take the CR/LF out of the source loops. Even has comments ;)
<!--- Query the DB --->
<cfquery name="t1" datasource="ds" dbtype="ODBC">
select distinct init
from test4
order by init
</cfquery>
<!--- Print the first All link --->
<cfoutput><a href="link.cfm##top">All</a></cfoutput>
<cfset letter=65>
<!--- Loop through the query. --->
<cfoutput query="t1">
<!--- Loop through all the letters until the next one in the query --->
<cfloop condition="letter LT 91 and chr(letter) is not t1.init">
#chr(letter)#<cfset letter=letter+1>
</cfloop>
<!--- Now assert that we're at the next one in the query OR we just
printed Z --->
<cfif t1.init is chr(letter)>
<a href="link.cfm##">#t1.init#</a>
<cfset letter=letter+1>
</cfif>
</cfoutput>
<!--- Now print out the rest of the letters AFTER the last one in the query
--->
<cfoutput>
<cfloop condition="letter LT 91">
#chr(letter)#<cfset letter=letter+1>
</cfloop>
</cfoutput>
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 26, 2001 11:42 AM
To: CF-Talk
Subject: Re: Alphabetic List
Thanks for your replies.
I think I didn't elaborate the question clearly.
What I need is to output the list:
All - A B C D E F G H I J K L M N O P Q R S T U V W X Y Z - Lists
If there are persons last names start with "B", B should be a hot link.
If there is no one's last name starts with "Q", Q is not clickable.
Thanks!
Hong
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists