Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
440 views
Welcome To Ask or Share your Answers For Others

1 Answer

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

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

Followed by this expression at the grouping level you want to display:

=RunningValue(
     Code.AggConcat(
         Fields!YourFieldToGroupBy.Value
       , Fields!YourFieldToConcat.Value
       )
   , Last
   , "YourGroupName" 
   )

"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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...