maxrows attribute and create your own counter.
<cfset mycount = 0 />
<cfoutput query="research" group="publication_title" >
<cfset mycount = ycount + 1 />
#publication_title#
<cfoutput>
#author_name#
</cfoutput>
<cfif mycount IS 10>
<cfexit>
</cfif>
</cfoutput>
Another way is to make sure you return only rows for your top 10
articles via SQL.
Got a 'Jedi' Oracle DBA? Have them create a collate() function to
collate columns into comma delimed lists. Then you can just use a sub
select to build a column with all the authors listed. The slickest
approach, eh?
Doug
----- Original Message -----
From: Christy Wilkens <[EMAIL PROTECTED]>
Date: Tue, 07 Sep 2004 14:52:45 -0400
Subject: cfoutput -- group and maxrows problem
To: CF-Talk <[EMAIL PROTECTED]>
Hi everyone,
I'm new to the list, but was driven to subscribe by a problem that's
been driving me mad for days.
I have three tables: publications, authors, and pub_author. I designed
it this way b/c pubs can have multiple authors, and I wanted a
controlled list of authors. They're joined like so:
SELECT p.publication_id, p.publication_title, a.author_name, a.author_id
FROM publications p, publication_author pa, authors a
WHERE p.publication_id = pa.pub_id
AND pa.auth_id = a.author_id
ORDER BY p.publication_title;
...which gives me multiple rows for publications with more than one
author. So Pub 1-Auth1, Pub1-Auth2, Pub2-Auth3, Pub3-Auth4 = 4 rows
for 3 records. My output uses grouped nested cfoutputs for display,
essentially like this:
<cfoutput query="research" group="publication_title" maxrows="10">
#publication_title#
<cfoutput>
#author_name#
</cfoutput>
</cfoutput>
But the maxrows attribute goes by the query record count, rather than
the count of unique publication_titles. So instead of seeing 10
records per page, I may get 6 or 9 or 7--the system is counting each
author row and thinks it's reached 10 before it actually has.
I've tried the custom tag cf_recordcount, and that counts correctly
*outside* the record listing (e.g., "Found 22 results" instead of
"Found 34"), but doesn't affect the way the cfoutput maxrows attribute
works.
Am I missing something totally obvious??
Thanks for any help.
-c________________________________
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

