Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Cascade parameters


Cascade parameters

Author
Message
mhaswood
mhaswood
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 2
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.
Mark Fitzgerald-331224
Mark Fitzgerald-331224
Hall of Fame
Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)

Group: General Forum Members
Points: 3692 Visits: 1513
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
Jeff Moden
Jeff Moden
SSC-Forever
SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)

Group: General Forum Members
Points: 45022 Visits: 39887
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.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Wink

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Mark Fitzgerald-331224
Mark Fitzgerald-331224
Hall of Fame
Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)

Group: General Forum Members
Points: 3692 Visits: 1513
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
mhaswood
mhaswood
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 2
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:-)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search