Delphi QuickReport:打印分组记录数
在 QuickReport 3 和 Delphi 中,如何打印按 TQRBand
类型 GroupFooter
分组的记录数?
涉及表达和计数吗?谢谢。
编辑:可以命名为“为每个组生成小计”。
假设我们有
<header>
<title>
<group header>
<deail>
<deail>
<deail>
<group footer> print here 3
<group header>
<deail>
<deail>
<group footer> print here 2
<summary>
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你不能自己做这件事吗?创建一个内存变量 iDetail: Integer 您必须在适用的 OnBeforePrint 方法处理程序中将其重新初始化为零。然后在你想要打印的地方执行inttostr(idetail)。
我发现 QuickReport 有很多限制,您必须自己编写此类内容。
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.
我通过混合记忆和 QR 帮助阅读来写这篇文章...我手头没有 QR 来测试我所说的内容,所以由您来测试在接受我的答案之前;)
删除 TQRExpr 组件在该组的页脚区域上。然后在对象检查器中找到表达式属性,您可能需要单击省略号按钮来启动表达式编辑器并使用计数函数构建新表达式。
或者您可能需要手动输入表达式,例如“Count(
Table1.Field1)”将 ResetAfterPrint 属性设置为 true,以指示组件在新组开始之前将计数器设置为 0。
您可能需要使用 Mask 属性来格式化该数字。
编辑
@none 表示 Count 不接受任何参数,因此我删除了最初括在括号中的参数,但我不确定是否必须使用括号本身(我无法测试它)。如果您有兴趣使用count而不是重新发明轮子,请评论它是否按现在所示工作(或不工作)。
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-.