[thelist] ASP equivalent to CFML question
rudy
r937 at interlog.com
Fri May 17 08:34:01 CDT 2002
> What does the [<cfoutput group="column">] CF Tag do?
> Does it work with a returned record set or with the SQL itself?
hi anthony
it works on the output, i.e. on the returned record set
i'll make up an example
let's say we have an emptable
dept employee
32 fred
53 mary
41 bill
32 john
41 jens
32 todd
17 lars
32 jane
now let's run a query to get employee details, and make sure to sort it by
dept because that's how we want to display the data
<cfquery name=empquery>
select dept, employee
from emptable
order by dept, employee
<cfquery>
now let's print it out, using the GROUP= parameter to group the depts
<cfoutput query=empquery group=dept>
Dept: #dept#
<cfoutput>
#employee#
</cfoutput>
</cfoutput>
the results look like this
Dept: 17
lars
Dept: 32
fred
jane
john
todd
Dept: 41
bill
jens
Dept: 53
mary
this is only a very simple example, just to show the function
the purpose of CFOUTPUT GROUP= is to, um, group the output
did you notice that there's no explicit looping there? that you don't have
to control the groups yourself?
one of the reasons i love ColdFusion is how simple and elegant, yet
comprehensive its output command is
rudy
More information about the thelist
mailing list