Solved

Stored Procedure to pass parameter to another SSRS report

Posted on 2010-08-24
2
855 Views
Last Modified: 2012-06-27
Hi Experts,

I have been unemployed since May and I will land this job if I can prove that I can pass parameters from one SSRS report to another with a Stored Procedure.

There are 2 reports, Sales Person Performance and Sales Person Detail.
In the performance table ContactID column I have a navigation property that jumps to the detail report. I pass both of the date parameters there.

I need to figure out how to make an SP that will grab the value of the ContactID that was clicked on and make it available for use as a parameter in the detail report.

Can anyone show me how to create such a procedure and use the value as a parameter in my detail report?

I am pasting the queries for the data sets for both reports below.

Performace Report:
SELECT     TOP (10) SUM(Sales.SalesOrderHeader.TotalDue) AS TotalDue, Person.Contact.FirstName, Person.Contact.LastName, Person.Contact.ContactID
FROM         Sales.SalesOrderHeader INNER JOIN
                      Person.Contact ON Sales.SalesOrderHeader.ContactID = Person.Contact.ContactID INNER JOIN
                      Sales.SalesPerson ON Sales.SalesOrderHeader.SalesPersonID = Sales.SalesPerson.SalesPersonID
WHERE     (Sales.SalesOrderHeader.OrderDate BETWEEN @StartDate AND @EndDate)
GROUP BY Person.Contact.LastName, Person.Contact.FirstName, Person.Contact.ContactID
ORDER BY TotalDue DESC

Detail Report:
SELECT     Sales.SalesOrderHeader.TotalDue, Person.Contact.FirstName, Person.Contact.LastName, Person.Contact.ContactID
FROM         Sales.SalesOrderHeader INNER JOIN
                      Person.Contact ON Sales.SalesOrderHeader.ContactID = Person.Contact.ContactID INNER JOIN
                      Sales.SalesPerson ON Sales.SalesOrderHeader.SalesPersonID = Sales.SalesPerson.SalesPersonID
WHERE     (Sales.SalesOrderHeader.OrderDate BETWEEN @DetailStartDate AND @DetailEndDate)
ORDER BY Person.Contact.ContactID

My 3rd interview with this company is this Thursday 8/26/2010
Any help would be so greatly appreciated!

Thanks

Dan
 
0
Comment
Question by:DanPerlman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Accepted Solution

by:
rashmi_vaghela earned 500 total points
ID: 33518214
0
 

Author Comment

by:DanPerlman
ID: 33525179
rashmi,

I have looked at the links provided. I don;t see what I'm looking for.
I need a stored procedure to get the value of the cell in the table that the user clicked on. When the jump to report fires, I need to use that specific value as a parameter in the detail report. I only want to display the contact id that was selected from the performance report in the detail report.
Does that make sense?

Thanks

Dan
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
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.

691 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