.NET ReportViewer-如何将总计放在每个页面的底部

发布于 2024-09-06 17:12:46 字数 75 浏览 0 评论 0原文

我创建了一个付款报告,我需要能够将总计放在每个页面的底部,例如付款总数、总余额等。rdlc 设计器不允许我引用页脚中的字段?感谢您的帮助

I have a created a report for payments and I need to be able to put totals at the bottom of each page such as the total number of payments, total balance etc. The rdlc designer will not allow me to reference Fields in the page footer? Thanks for the help

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

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

发布评论

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

评论(3

三生一梦 2024-09-13 17:12:47

更新答案

要执行您所要求的操作,您需要访问 ReportItems 集合。

来自 TechNet

  • ReportItems 集合是每个项目上的文本框的集合报表呈现后的页面。

下面将允许您将“付款”列的总计放入每个页面的页脚中。总计将只是该特定页面上的列的总计,而不是整个报告的总计:

=SUM(ReportItems!Payment.Value)

旧答案

您需要将 SUM 聚合函数的范围设置为基于创建报表的数据集。

以下内容将适合您(只需将所需的字段更改为 sum 和数据集的名称:

=Sum(Fields!ID.Value, "DataSet1")

如果您想过滤数据集,您甚至可以更进一步。以下代码将限制总和为超过 4 的 ID(修改示例并根据需要使用):

=Sum(IIF(Fields!ID.Value < 4,0,Fields!ID.Value), "DataSet1")

Updated Answer

To do what you're asking, you need to access the ReportItems collection.

From TechNet:

  • The ReportItems collection is the collection of text boxes on each page after report rendering occurs.

The following will allow you to put the total for a "Payment" column in the footer of each page. The total will be only the total of the column on that particular page and not the total for the entire report:

=SUM(ReportItems!Payment.Value)

Old Answer

You need to set the scope of the SUM aggregate function to be based on the dataset from which the report is created.

The following will work for you (just change the desired field to sum and the name of your dataset:

=Sum(Fields!ID.Value, "DataSet1")

You can even take things a step further if you want to filter the dataset. The following code will limit the sum to IDs over 4 (modify the example and take it as you need):

=Sum(IIF(Fields!ID.Value < 4,0,Fields!ID.Value), "DataSet1")
甜尕妞 2024-09-13 17:12:47

听起来像 UnitPrice 字段可能是字符串数据类型,而不是双精度或其他数字数据类型。

尝试使用此表达式来转换值:

=Sum( CDbl(Fields!UnitPrice.Value, "DataSet1"))

Sounds like the UnitPrice field might be a string datatype and not a double or other numeric datatype.

Try this expression to cast the value:

=Sum( CDbl(Fields!UnitPrice.Value, "DataSet1"))
断桥再见 2024-09-13 17:12:47

编辑表达式

输入类似这样的内容。

=Sum(Fields.BLAH.Value)

Edit expression

Enter something like this.

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