[英]SSRS Report Table Add Column Expression Record x of y?
I have an SSRS, which is compiled of report tables, each tied to a stored procedure, all keying off the same ID. 我有一个SSRS,它是由报告表编译而成,每个报告表都绑定到一个存储过程,所有这些都是相同的ID。 I pass the ID automatically, through the UI.
我通过UI自动传递ID。
Because there is so much information in the report, For each section, I wanted to add a column to each table, with an expression. 因为报告中有太多信息,所以对于每个部分,我想在每个表中添加一个列,并带有表达式。 It would give the record count.
它会给记录数。 This would mean, that if the table had an artist's albums, there would be a column for Album Record, and it would be something like this:
这意味着,如果桌子上有艺术家的专辑,那么专辑唱片会有一列,它会是这样的:
Arist: Pink Album Record Album Name Album Release Date Etc 1 of 5 2 of 5 3 of 5 Arist:Pink Album Record Album Name Album Release Date Etc 1 of 5 2 of 5 3 of 5
To build the pieces of the Album record, I added a row counter to the stored procedure. 为了构建Album记录的各个部分,我在存储过程中添加了一个行计数器。 This is that SQL line:
这就是SQL行:
,ROW_NUMBER() OVER (PARTITION BY pc.ID ORDER BY ARID.ID) 'Album Record Number'
pc.id is the ID parameter that is passed, which means, we only pass and retrieve 1 pc.ID. pc.id是传递的ID参数,这意味着,我们只传递和检索1个pc.ID. The ARID.ID is for the sub-record ID's.
ARID.ID用于子记录ID。
This creates the first piece. 这创造了第一件作品。 Record 1,2,3.
记录1,2,3。
In the SSRS table, I add a column and I make an expression: 在SSRS表中,我添加了一个列,并创建了一个表达式:
=Fields!Album_Record_Number.Value & " of " & Count(Fields!ARID.Value,"ID")
This should give me "1 of 3", "2 of 3", "3 of 3". 这应该给我“1 of 3”,“2 of 3”,“3 of 3”。
When I attempt to preview the report, I get an error: 当我尝试预览报告时,出现错误:
An error occurred during local report processing.
本地报告处理期间发生错误。 The definition of the report '/MainReport' is invalid.
报告'/ MainReport'的定义无效。 The Value expression for the text box 'XYZ' has a scope parameter that is not valid for an aggregate function.
文本框'XYZ'的值表达式具有对聚合函数无效的范围参数。 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.
scope参数必须设置为一个字符串,该字符串等于包含组的名称,包含数据区域的名称或数据集的名称。
Anyone know how to do what I'm trying to do? 任何人都知道如何做我想做的事情? I'm dreading that I may have to add the total count to the stored procedure, which means I would have to add that to all my stored procs.
我担心我可能必须将总计数添加到存储过程,这意味着我必须将其添加到我所有存储的过程中。 I was hoping an expression in a table column would do the trick.
我希望表格列中的表达式可以解决这个问题。
Any suggestions would be appreciated! 任何建议,将不胜感激!
I think you already using Groups
so you can use a similar expression: 我认为您已经使用了
Groups
因此您可以使用类似的表达式:
=RowNumber("YourAlbumGrouping") & " of " & CountRows("YourAlbumGrouping")
RowNumber
function returns a running count of the number of rows for the specified scope. RowNumber
函数返回指定范围的行数的运行计数。
CountRows
function returns the number of rows in the specified scope, including rows with null values. CountRows
函数返回指定范围内的行数,包括具有空值的行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.