如何计算报表的行数并隐藏标题

发布于 2024-07-30 11:06:58 字数 195 浏览 4 评论 0原文

我正在使用 Rave Reports for delphi 创建我的第一份报告。 我的记录显示得很好,我正处于完成前的最后阶段。 我有一组记录,仅当记录上的“注释”字段有数据(即字符串数据)时,我才会在打印前事件上使用 if 语句显示这些记录。 我遇到的问题是,当没有显示记录时,我仍然看到我的页眉和页脚。 如果“评论”字段中没有包含数据的记录,如何隐藏页眉和页脚?

I'm creating my first report with Rave Reports for delphi. I've got the records displaying nicely and I'm on the final stretch before finishing.
I have a set of records which I'm displaying with an if statement on the before print event ONLY if the 'comment' field on the record has data (which is string data). This The problem I have is that when no records are shown I'm still seeing my header and footer. How can I hide the header and footer if I have no records with data in their 'comment' field?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

呆头 2024-08-06 11:06:58

我不熟悉 Rave Reports,但您能否将页眉和页脚默认为不可见,然后在印前打印中,在执行评论数据存在时触发的代码时将它们设置为可见。

西蒙

I'm not familiar with Rave Reports but could you not default the header and footer to not being visible and then in the beforeprint, set them visible when you execute the code that triggers when the comment data is present.

Simon

夏天碎花小短裙 2024-08-06 11:06:58

谢谢您的帮助。 它引导我解决问题。 昨天我显然想太多了。 我尝试按照您的建议进行操作,虽然它没有结果,但当我有结果时,它缺少第一页上的页眉和页脚(奇怪的是页眉和页脚出现在第二页上)。

然后我查看了实际标题带上的 OnBeforePrint 事件。 由于某种原因,我认为这不会连接到数据视图,因为我认为只有数据带才能访问数据。 我尝试了他们的 if 语句,它有效。

如果其他人遇到这个问题,这里是我的标题数据带中的 OnBeforePrint 事件的代码:

if dvInvLineLineComment.AsString <> '' then
 bNotesHeadings.Visible := true;
end;

以及如果没有 LineComment 字段携带数据则隐藏该行的数据带的代码:

if dvInvLineLineComment.AsString = '' then
 dbNotes.Visible := false;
else
 dbNotes.Visible := true;
end;

希望对将来的某人有所帮助

Lloyd

Thanks for the help. It lead me to solve the problem. I was clearly overthinking the obvious yesterday. I tried doing what you suggested and whilst it worked for no results when I had results it was missing the header and footer off the first page (the odd thing was the header and footer were present on the second page).

I then looked into the OnBeforePrint event on the actual header band. I didn't think this would connect to the dataview for some reason as I thought only the databand would have access to the data. I tried the if statement in their and it's worked.

In case anyone else comes across this here is the code from my OnBeforePrint event in my header databand:

if dvInvLineLineComment.AsString <> '' then
 bNotesHeadings.Visible := true;
end;

and my code for the databand which hides the row if no LineComment field carries data:

if dvInvLineLineComment.AsString = '' then
 dbNotes.Visible := false;
else
 dbNotes.Visible := true;
end;

Hope that helps someone in the future

Lloyd

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文