Solved

How do I print an aggregate list of values in a group footer

Posted on 2008-10-06
4
215 Views
Last Modified: 2008-10-18
I have a column in the detail section of the report that flags the rows that meet certain criteria (example: "start date < currentdate").  In the group footer, I need to print the key value of the rows that got flagged or that met the criteria (example: 3557 Olson, 6593 Kent).  If I were doing the report in Crystal, I would create a shared variable that would accumulate the values as the rows were processed.  I don't know how to do a similar function in SSRS.  I wondered about RunningValue or Join but don't think these really apply to this situation.

Example of group contents with last column being the "flag" that indicates rows needing to be in list and the last line in the example being the "running list" I need to return:
Group: MN
2959   Grant   7/20/09    0
3557   Olson   9/15/08    1
3558   Jones  10/30/08   0
6593   Kent     8/15/08    1
6700   Tombs  12/1/08    0
MN Starts = 3557 Olson, 6593 Kent

Thanks
0
Comment
Question by:sanw2020
  • 2
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
rob_farley earned 250 total points
ID: 22655888
Easy to do it in the query using FOR XML PATH('') for string concatenation. Should be doable in SSRS too, but there's no nice concatenation function.

So... if you want to do it in the query, try something like:

select *, stuff((select ', ' + cast(t2.id as varchar(10)) + ' ' + t2.name from table t2 where t2.group = t1.group and t2.flag = 1 order by t2.id for xml path('')), 1, 2, '') as concatbit
from table t1
order by group

Rob
0
 

Author Comment

by:sanw2020
ID: 22658730
Are you saying that I should create the concatenated string while creating the Data for the report rather that while working on the Layout tab of the report?  Or are you saying that I can create a formula in the group footer section and embed the sql string in the formula?  

Sandy
0
 
LVL 15

Expert Comment

by:rob_farley
ID: 22665137
Well, I'm saying that you have creating it in the DataSet as an option. I'm not saying you should embed SQL in the formula.

Of course, if SSRS had a concatenate aggregate function, then it would be simple.

Rob
0
 

Author Comment

by:sanw2020
ID: 22668869
Thanks again for your response.  I'll give your suggestion a shot.

I'm surprised that I have only had one responder to this question...  Is this a stupid question?  A very simple/basic question?  Or a very hard question?  

Sandy
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
I have a large data set and a SSIS package. How can I load this file in multi threading?
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question