Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Cascade parameters Expand / Collapse
Author
Message
Posted Monday, October 28, 2013 2:57 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, October 29, 2013 12:19 PM
Points: 2, Visits: 1
I need some help with cascading parameters in a report with 2 stored procedures. My main sp (startdate and enddate parameters) has all the data I need except the sum of points (2nd sp) between startdate and enddate. The second sp has cstid, startdate and enddate as the parameters. The 2nd sp has all the points listed by cstkey,cstid, pointdatetaken, pointamt and pointtype. I'm not sure what is the best way to add in the 2nd sp so I can get all data I need from 1st sp and sum of points from 2nd sp by each customer. I appreciate any suggestions. Thank you.
Post #1509121
Posted Tuesday, October 29, 2013 5:38 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Monday, September 15, 2014 3:14 PM
Points: 3,145, Visits: 1,366
mhaswood (10/28/2013)
I need some help with cascading parameters in a report with 2 stored procedures. My main sp (startdate and enddate parameters) has all the data I need except the sum of points (2nd sp) between startdate and enddate. The second sp has cstid, startdate and enddate as the parameters. The 2nd sp has all the points listed by cstkey,cstid, pointdatetaken, pointamt and pointtype. I'm not sure what is the best way to add in the 2nd sp so I can get all data I need from 1st sp and sum of points from 2nd sp by each customer. I appreciate any suggestions. Thank you.


You have stated that the 2nd SP will be used to populate a parameter. Are you sure that these are not just two datasets? What do you want displayed for each of the parameters?

I think you are looking at two datasets, one for each SP.

Option 1:
If this is the case setup the report with a subreport. The main (header) report uses the Start and End parameters to populate the call to SP1. The subreport would be included within a tablix on the main report aligned to each row in the first SP. The subreport dataset would be based on SP2 with the Start and End date parameters passed (from the main report parameters) and the cstkey from the first dataset (on the main report). This would populate the SP2 data for each cstkey found using SP1.

Option 2:
You could change the dataset to use temporary tables (or CTE) to retrieve the results from the two SP and join the results into a single result set.

Hope this helps, I my assumptions are wrong I will endeavour to answer with more details.

Fitz
Post #1509288
Posted Tuesday, October 29, 2013 8:55 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 9:16 PM
Points: 37,102, Visits: 31,655
OPTION 3:

Do it all in T-SQL (control SP that calls the other 2?) and just present the final result set to Reporting Services.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1509401
Posted Tuesday, October 29, 2013 8:59 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Monday, September 15, 2014 3:14 PM
Points: 3,145, Visits: 1,366
Jeff Moden (10/29/2013)
OPTION 3:

Do it all in T-SQL (control SP that calls the other 2?) and just present the final result set to Reporting Services.


Agreed, Jeff. If the assumptions are correct and the user can have a controlling SP then option 2 can be done on the server side only allowing for greater control.

Fitz
Post #1509405
Posted Tuesday, October 29, 2013 12:24 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, October 29, 2013 12:19 PM
Points: 2, Visits: 1
I tried all your suggestions and option 3 worked. I was able to add in the points to the first sp and grouped all fields by cstkey in ssrs and got to display all the fields the way I wanted. Thank you so much for your help!

mh
Post #1509517
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse