You don't need a list or ASCII characters or anything, just use REGEX to
determine if it's a letter.
This should give you what you need. If you want numbers too, then you
can change [a-zA-Z] to [0-9a-zA-Z] and it will display numeric entries
as well.
<cfquery datasource="#request.dsn#" name="qGetAlphaIndex">
SELECT DISTINCT(UPPER(Left(column_name,1))) AS First_Letter
FROM tablename
ORDER BY First_Letter ASC
</cfquery>
<cfoutput query="qGetAlphaIndex">
<cfif ReFindNoCase("[a-zA-Z]",First_Letter)>
<a href="mypage.cfm?L=#First_Letter#">#First_Letter#</a>
<cfif qGetAlphaIndex.CurrentRow NEQ
qGetAlphaIndex.RecordCount> | </cfif>
</cfif>
</cfoutput>
Hope that helps.
Joshua Miller
Head Programmer / IT Manager
Garrison Enterprises Inc.
www.garrisonenterprises.net
[EMAIL PROTECTED]
(704) 569-0801 ext. 254
************************************************************************
*************
Any views expressed in this message are those of the individual sender,
except where the sender states them to be the views of
Garrison Enterprises Inc.
This e-mail is intended only for the individual or entity to which it is
addressed and contains information that is private and confidential. If
you are not the intended recipient you are hereby notified that any
dissemination, distribution or copying is strictly prohibited. If you
have received this e-mail in error please delete it immediately and
advise us by return e-mail to [EMAIL PROTECTED]
************************************************************************
*************
-----Original Message-----
From: Ian Skinner [mailto:[EMAIL PROTECTED]
Sent: Friday, August 29, 2003 4:27 PM
To: CF-Talk
Subject: RE: Okay, what's the first part of those alphabetical
navigation strips?
An earlier reply gave you the condition logic you are looking for.
This part you got figured out.
<cfquery name=firstLet....>
</cfquery>
<cfset listofexistingletters = valuelist(firstlet.firstlettercolumn)>
VALUELIST(query.column) is a function that will take one column of your
query and turn it into a list like this. {A,B,D,E,M,N,P,Q,R,X,Y,Z}
Now in your output of the alphabet you can check each letters existence
in the above list.
<cfloop from=a to=z index=i>
(this is sudocode you will have to either use another list or use the
ASCII
method)
<cfif listcontains(listofexistingletters,i)>
this will return a non-zero value or true if the current letter
(i) is in the list stored in (listofexistingletters).
do the anchor stuff if true
<cfelse>
do the plain text if false
</cfif>
</cfloop>
HTH
--------------
Ian Skinner
Web Programmer
BloodSource
Sacramento, CA
-----Original Message-----
From: Jeff [mailto:[EMAIL PROTECTED]
Sent: Friday, August 29, 2003 12:07 PM
To: CF-Talk
Subject: Re: Okay, what's the first part of those alphabetical
navigation strips?
on 8/29/03 2:21 PM, Jerry Johnson at [EMAIL PROTECTED] wrote:
> You're in luck.
>
> Someone else has already assembled the letters in a nice, convenient
> order
for
> you.
>
> You can use the ASCII table to get the alphabet.
>
> If you just want the letters A-Z, you can grab the ascii characters
between 65
> and 90
>
> You can then use the chr() built in function to turn a number (like
> 65)
into
> an ASCII letter (like "A")
>
> For example:
>
> <cfloop index="i" from="65" to="90" step="1">
> <cfset letter=chr(i)>
> <cfoutput>#letter#</cfoutput>
> </cfloop>
>
> HTH
> Jerry Johnson
Okay, I've got almost ALL the parts in place. But there's ONE LAST part
that I'm having trouble with. It's the expression to check for the
existance of an entry.
Of course the easiest way would be to just pass the first letter of each
letter in the alphabet, and on the following page simply check
recordcount to see if there are any entries corresponding to that
letter.
That seems like the wussy way out. I'd rather have it be clean, so what
I'd LIKE to do is somehow loop over that list, and compare each row of
the query object for the existance of an entry, but darnit, it's just
plain escaping me how to do this.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community.
http://www.fusionauthority.com/ads.cfm