Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using startrow / maxrows in a grouped cfquery

Status
Not open for further replies.

yippiekyyay

Programmer
Oct 26, 2002
186
CA
Hello,

I noticed that I can't do this:
<cfoutput query="myResult" startrow="1" maxrows="10" group="mainGroup">

It'll group by mainGroup - but ignore the start and max row variables and just print all the records. Am I missing something?

I could add a variable (a flag) to suppress the mainGroup from printing on each record - but that seems inneficient. Just thought I would verify with you guys first!

Thanks in advance!
-Sean
 
I've never used start and maxrows before but when you use group = "bla" it's expecting you to have a nested cfoutput to run a loop. if you have 8 groups and each group had 12 rows it would make sence to me that all 8 groups and 12 rows would show up. because you're limiting the outer loop to 10 loops. The inner loops don't have any restrictions so it'll show all 12. Like I said, I don't use those controlls so I could be wrong, but it makes sence to me...

A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
-Douglas Adams (1952-2001)
 
Thanks bombboy - you're absolutely right! I just tried setting my maxrows to 2 and that displayed all records belonging only to the first 2 groups.

So now I'll just try different nesting orders and see how I do (I'll repost when I finish).

Thanks again!
-Sean
 
Well, it didn't come right away and I'm in a bit of a hurry so I just did what I mentioned in my original post - created a variable/flag for the group, if it's already printed then don't print it again.

Seems like cheating but at least it got the job done!

-Sean
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top