On 8/17/06, Les Mizzell <[EMAIL PROTECTED]> wrote:
> What's the best way to accomplish this, since you can't use the maxrows
> attribute inside a group?
>
> <cfoutput query="categories" group="MAIN_CATEGORY">
>    #MAIN_CATEGORY# <!---Show all, regardless of how many--->
>     <cfoutput maxrows="3"> <!--- Limit to top 3 in each category--->
>       #Sub_cat#
>     </cfoutput>
> </cfoutput>
>

<cfoutput query="categories" group="MAIN_CATEGORY">
      #MAIN_CATEGORY# <!---Show all, regardless of how many--->
<cfset n = 1>
     <cfoutput maxrows="3"> <!--- Limit to top 3 in each category--->
       <cfif n LT 4>#Sub_cat#</cfif>
       <cfset n = n + 1>
    </cfoutput>
</cfoutput>

There is probably some more efficient way...the above might bog down a
bit if you have lots of items in each category...I don't think there
is a way to break out of the inner cfoutput like the cfbreak for a
loop.

-- 
Jim Wright
Wright Business Solutions
[EMAIL PROTECTED]
919-417-2257

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250193
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to