Limit printing in group
Hi everyone,
I'm building a report that should display the top 10 item on each group.
However, it doesn't work if I use Count to check the number of record
print.(It'll always print blank report)
Here's the query:
*** Query1.SQL ***
select F.TYPEID, FT.TYPENAME, D.DISHID, F.FOODNAME, D.QTY, sum(D.QTY *
D.PRICE) as sumprice from dishesb as D, Food as F, FoodType as FT, txb as T
where (F.FOODID = D.DISHID)
and (FT.TYPEID = F.TYPEID)
and (D.CUSTNO = T.CUSTNO)
and (T.PERIOD >= '20020901')
and (T.PERIOD <= '20020901')
and (D.VOIDED = 'N')
and (T.VOIDED = 'N')
group by D.DISHID
order by F.TYPEID, sumprice DESC
*** End of Quote ***
The group band variable is F.TYPEID. I want that when the count within the
groupband reach 10, it will stop working on this group and jump to the next
group.
Can anyone show me how to do it?
I'm building a report that should display the top 10 item on each group.
However, it doesn't work if I use Count to check the number of record
print.(It'll always print blank report)
Here's the query:
*** Query1.SQL ***
select F.TYPEID, FT.TYPENAME, D.DISHID, F.FOODNAME, D.QTY, sum(D.QTY *
D.PRICE) as sumprice from dishesb as D, Food as F, FoodType as FT, txb as T
where (F.FOODID = D.DISHID)
and (FT.TYPEID = F.TYPEID)
and (D.CUSTNO = T.CUSTNO)
and (T.PERIOD >= '20020901')
and (T.PERIOD <= '20020901')
and (D.VOIDED = 'N')
and (T.VOIDED = 'N')
group by D.DISHID
order by F.TYPEID, sumprice DESC
*** End of Quote ***
The group band variable is F.TYPEID. I want that when the count within the
groupband reach 10, it will stop working on this group and jump to the next
group.
Can anyone show me how to do it?
This discussion has been closed.
Comments
your database supporting this in SQL, you can use a TOP clause to limit the
rows returned. I know you can do it in MS SQL Server. You should be able
to create a master detail report instead of a group style report, and place
the TOP clause on the detail query.
Otherwise, you could use a TppVariable in the detail band. Set the variable
to reset on the group. In the variable's OnCalc event handler, have it
increment its value by one. When the value reaches 10 in this event
handler, set the detail band to be invisible. In the group object's (use the
object inspector drop down list to find the TppGroup object) AfterGroupBreak
event, you can set the detailband back to being visible.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com