none
none

Reputation: 4827

Delphi QuickReport: print number of grouped records

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

<header>
<title>
<group header>
<deail>
<deail>
<deail>
<group footer> print here 3

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

<summary>

Upvotes: 0

Views: 3678

Answers (2)

jachguate
jachguate

Reputation: 17203

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

Upvotes: 0

M Schenkel
M Schenkel

Reputation: 6364

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.

Upvotes: 1

Related Questions