Solved

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

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

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 14

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
PL/SQL query 14 46
.htaccess file settings 4 35
SQL Connection (Error 18456) 14 32
SQL Inner Join Vs SubQueries 9 25
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

705 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now