开发者

Delphi QuickReport: print number of grouped records

开发者 https://www.devze.com 2023-01-25 14:10 出处:网络
In QuickReport 3 and Delphi, how do you print the number of records that where grouped by the TQRBand type GroupFooter?

In QuickReport 3 and Delphi, how do you print the number of records that where grouped by the TQRBand type GroupFooter?

Does it involve expression and Count? Thanks.

EDIT: could be named as "generate a subtotal for each group".

Let's say we have

<hea开发者_开发技巧der>
<title>
<group header>
<deail>
<deail>
<deail>
<group footer> print here 3

<group header>
<deail>
<deail>
<group footer> print here 2

<summary>


Couldn't you just do this yourself? Make a memory variable iDetail: Integer You will have to reinitialize it to zero in the applicable OnBeforePrint method handler. Then where you want it to print do a inttostr(idetail).

I have found QuickReport to have many limitations where you have to program stuff like this yourself.


I write this by mix of memory and QR help reading... I have no QR at hand to test what I say, so it's up to you to test before accepting my answer ;)

Drop a TQRExpr component on your footer band for that group. Then locate the Expression property in Object inspector and you may want to click on the ellipsis button to launch the expression editor and build a new expression using the count function.

Or you may want to enter the expression manually, like 'Count(Table1.Field1)'

Set the ResetAfterPrint property to true to instruct the component put the counter at 0 before a new group starts.

You may want to use the Mask property to format that number.

Edit @none states Count does not take any arguments, so I deleted the one I originally enclosed in the parenthesis, but I'm not sure if you must use the parenthesis itself or not (I have no way to test it). If you're interested in use count instead of reinventing the wheel, please comment if it works as shown now -or not-.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号