RE: cfoutput lists Alphabetically

2001-04-13 Thread Ian MacFadyen

You also avoid all the looped queries and conditional code by writing 1 SQL
query and grouping your cfoutput:

CFQUERY NAME="directory" DATASOURCE="someds"
SELECT
lastname,
firstname,
LEFT(lastname, 1) AS letterindex
FROM
Directory_tbl
ORDER BY
letterindex,
lastname,
firstname
/CFQUERY

CFOUTPUT QUERY="directory" GROUP="letterindex"
#directory.letterindex#BR
CFOUTPUT#directory.lastname#, #directory.firstname#BR/CFOUTPUT
/CFOUTPUT

Ian MacFadyen
Sr. Application Developer
Cardinal Communications
http://www.cardinalweb.com
[EMAIL PROTECTED]
ph. 510.647.1400 x 210


-Original Message-
From: Christine Kelley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 12, 2001 10:28 AM
To: CF-Talk
Subject: cfoutput lists Alphabetically



Hi!
   How do I output a whole list of names from a query
grouped alphabetically?  Output example:

A
Allen, Bob
Ames, John

B
Book, Sam
Briant, Max

I'm thinking it's by somehow using the group attribute of
the cfoutput tag or looping through the query, but I'm
not sure exactly how to get these results.

Thank-you for any help!
   Christine


~~
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



cfoutput lists Alphabetically

2001-04-12 Thread Christine Kelley


Hi!
   How do I output a whole list of names from a query 
grouped alphabetically?  Output example:

A
Allen, Bob
Ames, John

B
Book, Sam
Briant, Max

I'm thinking it's by somehow using the group attribute of 
the cfoutput tag or looping through the query, but I'm 
not sure exactly how to get these results.

Thank-you for any help!
   Christine


~~
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



RE: cfoutput lists Alphabetically

2001-04-12 Thread Simon Horwith

Try adding "ASCII(lastname) AS thesortkey" into your select clause, then
group by thesortkey and order by lastname at the end of your where clause.

~Simon

Simon Horwith
Macromedia Certified Instructor
Certified ColdFusion Developer
Fig Leaf Software
1400 16th St NW, # 500
Washington DC 20036
202.797.6570 (direct line)
www.figleaf.com



-Original Message-
From: Christine Kelley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 12, 2001 1:28 PM
To: CF-Talk
Subject: cfoutput lists Alphabetically



Hi!
   How do I output a whole list of names from a query 
grouped alphabetically?  Output example:

A
Allen, Bob
Ames, John

B
Book, Sam
Briant, Max

I'm thinking it's by somehow using the group attribute of 
the cfoutput tag or looping through the query, but I'm 
not sure exactly how to get these results.

Thank-you for any help!
   Christine
~~
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



RE: cfoutput lists Alphabetically

2001-04-12 Thread Bruce, Rodney

this is one way.


CFLOOP index="letter"
list="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" delimiters=","
CFQUERY name="list" datasource="database" dbtype="ODBC"
SELECT table.fname, table.lname
FROM table
WHERE table.name Like '#letter#%'
ORDER BY table.name;
/CFQUERY

CFOUTPUT#letter#/CFOUTPUT
CFOUTPUT Query="list"
#list.lname#, #list.fname#
/CFOUTPUT
/CFLOOP

-Original Message-
From: Christine Kelley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 12, 2001 10:28 AM
To: CF-Talk
Subject: cfoutput lists Alphabetically



Hi!
   How do I output a whole list of names from a query 
grouped alphabetically?  Output example:

A
Allen, Bob
Ames, John

B
Book, Sam
Briant, Max

I'm thinking it's by somehow using the group attribute of 
the cfoutput tag or looping through the query, but I'm 
not sure exactly how to get these results.

Thank-you for any help!
   Christine
~~
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



Re: cfoutput lists Alphabetically

2001-04-12 Thread Pooh Bear

in your SQL statement, do an ORDER BY


For example, I want to sort by last name in alphabetical order, my SQL would 
be like

SELECT FirstName, LastName, Address
FROM ClientInfo
Order By LastName


From: Christine Kelley [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Subject: cfoutput lists Alphabetically
Date: Thu, 12 Apr 2001 17:28:06 GMT


Hi!
How do I output a whole list of names from a query
grouped alphabetically?  Output example:

A
Allen, Bob
Ames, John

B
Book, Sam
Briant, Max

I'm thinking it's by somehow using the group attribute of
the cfoutput tag or looping through the query, but I'm
not sure exactly how to get these results.

Thank-you for any help!
Christine



~~
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



RE: cfoutput lists Alphabetically

2001-04-12 Thread Bruce, Rodney

Oops, sorry

ORDER BY table.name;  should be: ORDER BY table.lname;

Type O,  lost the l :o)

-Original Message-
From: Christine Kelley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 12, 2001 10:28 AM
To: CF-Talk
Subject: cfoutput lists Alphabetically



Hi!
   How do I output a whole list of names from a query 
grouped alphabetically?  Output example:

A
Allen, Bob
Ames, John

B
Book, Sam
Briant, Max

I'm thinking it's by somehow using the group attribute of 
the cfoutput tag or looping through the query, but I'm 
not sure exactly how to get these results.

Thank-you for any help!
   Christine
~~
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



RE: cfoutput lists Alphabetically

2001-04-12 Thread Dylan Bromby

in your query add:

ORDER BY
lastname ASC

-Original Message-
From: Christine Kelley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 12, 2001 10:28 AM
To: CF-Talk
Subject: cfoutput lists Alphabetically



Hi!
   How do I output a whole list of names from a query
grouped alphabetically?  Output example:

A
Allen, Bob
Ames, John

B
Book, Sam
Briant, Max

I'm thinking it's by somehow using the group attribute of
the cfoutput tag or looping through the query, but I'm
not sure exactly how to get these results.

Thank-you for any help!
   Christine
~~
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



RE: cfoutput lists Alphabetically

2001-04-12 Thread Troy Hiltbrand

cfset Variables.InitialLetter=""

cfoutput query="queryName"
cfif InitialLetter is not LEFT(field,1)
cfset Variables.InitialLetter= LEFT(field,1)
#InitialLetter#br
/cfif
#field#
/cfoutput

-Original Message-
From: Christine Kelley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 12, 2001 11:28 AM
To: CF-Talk
Subject: cfoutput lists Alphabetically


Hi!
   How do I output a whole list of names from a query
grouped alphabetically?  Output example:

A
Allen, Bob
Ames, John

B
Book, Sam
Briant, Max

I'm thinking it's by somehow using the group attribute of
the cfoutput tag or looping through the query, but I'm
not sure exactly how to get these results.

Thank-you for any help!
   Christine
~~
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



Re: cfoutput lists Alphabetically

2001-04-12 Thread Dave Hannum

Do it in your SQL.

ORDER BY LastNameColumn

Then, do your group buy

Dave


- Original Message -
From: "Christine Kelley" [EMAIL PROTECTED]
To: "CF-Talk" [EMAIL PROTECTED]
Sent: Thursday, April 12, 2001 1:28 PM
Subject: cfoutput lists Alphabetically



 Hi!
How do I output a whole list of names from a query
 grouped alphabetically?  Output example:

 A
 Allen, Bob
 Ames, John

 B
 Book, Sam
 Briant, Max

 I'm thinking it's by somehow using the group attribute of
 the cfoutput tag or looping through the query, but I'm
 not sure exactly how to get these results.

 Thank-you for any help!
Christine



~~
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



RE: cfoutput lists Alphabetically

2001-04-12 Thread kmansel

This would be an order by statement in your SQL call...

like so...


cfquery name="info" datasource="yourdb"
SELECT *
FROM Customers
ORDER BY LastName DESC
/cfquery

use that ORDER BY statement as a DESC - descending, or ASC ascending...

hth

kevin

~
Kevin Mansel
Web Developer
Fox Communications
[EMAIL PROTECTED]
DL : 425-649-1321
C : 425-346-7221



-Original Message-
From: Christine Kelley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 12, 2001 10:28 AM
To: CF-Talk
Subject: cfoutput lists Alphabetically



Hi!
   How do I output a whole list of names from a query 
grouped alphabetically?  Output example:

A
Allen, Bob
Ames, John

B
Book, Sam
Briant, Max

I'm thinking it's by somehow using the group attribute of 
the cfoutput tag or looping through the query, but I'm 
not sure exactly how to get these results.

Thank-you for any help!
   Christine
~~
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



RE: cfoutput lists Alphabetically

2001-04-12 Thread Hayes, David

Try something like this:

SELECT LEFT(lastName,1) as Initial, lastname, firstname from myTable order
by Initial, lastname

Then you can use the grouping attribute on the Initial field.

CFOUTPUT query="myquery" group="Initial"
#initial#
CFOUTPUT
#lastname#, #firstName#
/CFOUTPUT
/CFOUTPUT

-Original Message-
From: Christine Kelley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 12, 2001 12:28 PM
To: CF-Talk
Subject: cfoutput lists Alphabetically



Hi!
   How do I output a whole list of names from a query 
grouped alphabetically?  Output example:

A
Allen, Bob
Ames, John

B
Book, Sam
Briant, Max

I'm thinking it's by somehow using the group attribute of 
the cfoutput tag or looping through the query, but I'm 
not sure exactly how to get these results.

Thank-you for any help!
   Christine
~~
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



RE: cfoutput lists Alphabetically

2001-04-12 Thread Dylan Bromby

that's a little extreme (26 queries).

try something like this:

--
CFQUERY NAME="get_names" DATASOURCE="(your DSN)"
SELECT
firstname,
lastname
FROM
yourtable
ORDER BY
lastname ASC
/CFQUERY

CFSET rem_letter= ""
CFSET first_letter = "a"

CFOUTPUT QUERY="get_names"
CFIF #first_letter# IS NOT #rem_letter#
BR
#Ucase(Left(lastname, 1))#
BR
/CFIF
#lastname#, #firstname#
BR
CFSET rem_letter = #Left(lastname, 1)#
/CFOUTPUT
--

-Original Message-
From: Bruce, Rodney [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 12, 2001 10:44 AM
To: CF-Talk
Subject: RE: cfoutput lists Alphabetically


this is one way.


CFLOOP index="letter"
list="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" delimiters=","
CFQUERY name="list" datasource="database" dbtype="ODBC"
SELECT table.fname, table.lname
FROM table
WHERE table.name Like '#letter#%'
ORDER BY table.name;
/CFQUERY

CFOUTPUT#letter#/CFOUTPUT
CFOUTPUT Query="list"
#list.lname#, #list.fname#
/CFOUTPUT
/CFLOOP

-Original Message-
From: Christine Kelley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 12, 2001 10:28 AM
To: CF-Talk
Subject: cfoutput lists Alphabetically



Hi!
   How do I output a whole list of names from a query
grouped alphabetically?  Output example:

A
Allen, Bob
Ames, John

B
Book, Sam
Briant, Max

I'm thinking it's by somehow using the group attribute of
the cfoutput tag or looping through the query, but I'm
not sure exactly how to get these results.

Thank-you for any help!
   Christine
~~
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



Re: cfoutput lists Alphabetically

2001-04-12 Thread Tim Painter

Try something like this:
cfquery name="foo" datasource="bar"
Select LEFT(Users, 1) AS abcOrder,
UserFirstName, UserLastName
From Users
Order by abcorder
/cfquery


cfoutput query="foo" group="abcorder"
#Ucase(abcOrder)#br
ul
 cfoutput#UserLastName#, #UserFirstName#/cfoutput
/ul
/cfoutput

- Original Message -
From: "Christine Kelley" [EMAIL PROTECTED]
To: "CF-Talk" [EMAIL PROTECTED]
Sent: Thursday, April 12, 2001 1:28 PM
Subject: cfoutput lists Alphabetically



 Hi!
How do I output a whole list of names from a query
 grouped alphabetically?  Output example:

 A
 Allen, Bob
 Ames, John

 B
 Book, Sam
 Briant, Max

 I'm thinking it's by somehow using the group attribute of
 the cfoutput tag or looping through the query, but I'm
 not sure exactly how to get these results.

 Thank-you for any help!
Christine



~~
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



RE: cfoutput lists Alphabetically

2001-04-12 Thread Peter Stolz

Try,

CFQUERY NAME="q" DATASOURCE="#DSN#"
SELECT *, SUBSTRING(lname,1,1) AS FirstLetter
FROM MyTable
ORDER BY FirstLetter
/CFQUERY

CFOUTPUT QUERY="q" GROUP="FirstLetter"
#FirstLetter#
CFOUTPUT
#lname#, #fname#
/CFOUTPUT
/CFOUTPUT


HTH

P.


-Original Message-
From: Christine Kelley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 12, 2001 1:28 PM
To: CF-Talk
Subject: cfoutput lists Alphabetically



Hi!
   How do I output a whole list of names from a query
grouped alphabetically?  Output example:

A
Allen, Bob
Ames, John

B
Book, Sam
Briant, Max

I'm thinking it's by somehow using the group attribute of
the cfoutput tag or looping through the query, but I'm
not sure exactly how to get these results.

Thank-you for any help!
   Christine
~~
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



RE: cfoutput lists Alphabetically

2001-04-12 Thread Christian L. Watt

Try this query (given earlier) and this code for your output:

cfquery name="info" datasource="yourdb"
SELECT *
FROM Customers
ORDER BY LastName DESC
/cfquery

cfset fletter = ""
Table
cfoutput query="info" 
cfif fletter neq Left(Lastname, 1)
cfset fletter = Left(Lastname, 1)
tr
td#fletter#/td
/tr
/cfif
tr
td
#lastname# , #FirstName#
/td
/tr
/cfoutput
/table
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 12, 2001 12:53 PM
To: CF-Talk
Subject: RE: cfoutput lists Alphabetically


This would be an order by statement in your SQL call...

like so...


cfquery name="info" datasource="yourdb"
SELECT *
FROM Customers
ORDER BY LastName DESC
/cfquery

use that ORDER BY statement as a DESC - descending, or ASC ascending...

hth

kevin

~
Kevin Mansel
Web Developer
Fox Communications
[EMAIL PROTECTED]
DL : 425-649-1321
C : 425-346-7221



-Original Message-
From: Christine Kelley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 12, 2001 10:28 AM
To: CF-Talk
Subject: cfoutput lists Alphabetically



Hi!
   How do I output a whole list of names from a query 
grouped alphabetically?  Output example:

A
Allen, Bob
Ames, John

B
Book, Sam
Briant, Max

I'm thinking it's by somehow using the group attribute of 
the cfoutput tag or looping through the query, but I'm 
not sure exactly how to get these results.

Thank-you for any help!
   Christine
~~
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