Solved

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

Posted on 2008-10-06
4
216 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

How to increase the row limit in Jasper Server.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

679 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