问题描述
使用BIDS 2005年创建RDL报告。我想有报告汇总在一个数据组中的所有字符串。我一直在寻找沿并置的东西线(场!CompanyName.Value,),或加入,或同等学历。但它必须遍历在给定范围内的所有记录。
Using BIDS 2005 to create rdl reports. I want to have the report aggregate all the strings in a data group. I was looking for something along the lines of Concatenate(Fields!CompanyName.Value, ","), or Join, or equivalent. But it would have to iterate over all the records in the scope given.
我创建了一个用户的活动以日历格式(看起来像在谷歌的月视图日历)的一份报告,但如果用户有多个活动一天我希望他们都出现在相同的天盒。这是一个问题,需要聚集或者是有一些其他的方式来获得一个SSRS报告,要做到这一点,我试图弄清楚一种方式来获得的矩阵来为我做的,但我打墙。
I am creating a report of a user's activities in a calendar format (looking like the google's month view calendar) But if a user has multiple activities on a single day I want all of them to show up in the same 'day box'. Is this a problem needing aggregation or is there some other way to get a SSRS report to do this, I have tried to figure a way to get the matrix to do it for me but I am hitting walls.
推荐答案
通常的方式做总串联在SSRS与定制code。见这里的一个例子:
The usual way to do aggregate concatenation in SSRS is with custom code. See here for an example:
http://blogs.msdn.com/suryaj/archive/2007/08/11/string-aggregation.aspx
下面是自定义code的基本形式:
Here's the custom code in basic form:
Private CurrGroupBy As String = String.Empty
Private ConcatVal As String = String.Empty
Public Function AggConcat(GroupBy as String, ElementVal as String) as String
If CurrGroupBy = GroupBy Then
ConcatVal = ConcatVal & ", " & ElementVal
Else
CurrGroupBy = GroupBy
ConcatVal = ElementVal
End If
Return ConcatVal
End Function
跟此EX pression在分组级别要显示:
Followed by this expression at the grouping level you want to display:
=RunningValue(
Code.AggConcat(
Fields!YourFieldToGroupBy.Value
, Fields!YourFieldToConcat.Value
)
, Last
, "YourGroupName"
)
YourGroupName是典型的table1_Group1,如果它是第一个表,你已经在报告中创建的第一个组,如果没有指定一个不同的名称。
"YourGroupName" is typically "table1_Group1", if it is the first table and the first group you have created in the report, and if you didn't specify a different name.
这篇关于在SSRS 2005串聚集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!