SSRS 报告 Table 添加列表达式记录 x of y?

SSRS Report Table Add Column Expression Record x of y?

我有一个 SSRS,它由报告 tables 编译而成,每个报告都绑定到一个存储过程,所有这些都使用相同的 ID。我通过 UI.

自动传递 ID

因为报告中的信息量太大,所以对于每个section,我想给每个table加一列,用一个表达式。它会给出记录计数。这意味着,如果 table 有一个艺术家的专辑,就会有一个专辑记录列,它会是这样的:

艺术家:粉色 专辑记录专辑名称专辑发行日期等 1 的 5 5 之 2 5 之 3

为了构建专辑记录,我在存储过程中添加了一个行计数器。这是 SQL 行:

,ROW_NUMBER() OVER (PARTITION BY pc.ID ORDER BY ARID.ID) 'Album Record Number'

pc.id是传递的ID参数,也就是说,我们只传递和检索1个pc.ID。 ARID.ID 用于子记录 ID。

这就创建了第一块。记录 1,2,3.

在 SSRS table 中,我添加了一列并创建了一个表达式:

=Fields!Album_Record_Number.Value & " of " & Count(Fields!ARID.Value,"ID")

这应该给我“3 个中的 1”、“3 个中的 2”、“3 个中的 3”。

当我尝试预览报表时,出现错误:

An error occurred during local report processing. The definition of the report '/MainReport' is invalid. The Value expression for the text box 'XYZ' has a scope parameter that is not valid for an aggregate function. The scope parameter must be set to a string that is equal to either the name of a containing group, the name of a containing data region or the name of a dataset.

有人知道如何做我想做的事吗?我担心我可能必须将总数添加到存储过程中,这意味着我必须将其添加到我所有的存储过程中。我希望 table 列中的表达式可以解决问题。

如有任何建议,我们将不胜感激!

我想你已经在使用 Groups 所以你可以使用类似的表达式:

=RowNumber("YourAlbumGrouping") & " of " & CountRows("YourAlbumGrouping")

RowNumber 函数 returns 对指定范围的行数进行 运行 计数。

CountRows函数returns指定范围内的行数,包括具有空值的行。