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


Christy,


I don't have a smart and elegant solution.  Someone else is bound to post
that moments after I post my kludgy solution, which is:


Let your query pull more than 10 records (say, 50) and remove the maxrows
attribute from your CFOUTPUT tag.  Then, change your code to:


<CFSET i=0>
<cfoutput query="research" group="publication_title">
<CFSET i=i+1>
<CFIF i lte 10>
    <CFSET LastPubViewed = #publication_id#>
#publication_title#
   <cfoutput>
     #author_name#
   </cfoutput>
</CFIF>
</cfoutput>

When you are done, you will have the list limited to ten publications.
Further, you'll have the variable LastPubViewed that gives you the last ID
you saw.  You can use this last ID seen to help you show the next set.
(I've always found moving to the next page of such lists tricky.)


HTH,
Matthieu
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to