SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 2 datasets used for same detail line on SSRS 2008
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jassie
Constraint Violating Yak Guru

308 Posts

Posted - 10/08/2013 :  12:26:13  Show Profile  Reply with Quote
In a SSRS 2008 r2 report, there is currently one dataset that is used for the detail line. However, now I would like to use 2 different datasets on the detail line that is displayed. The code would know what dataset to use based upon a new parameter that would be passed to the rdl.

Thus can you tell me if what I am thinking is possibly? If so, how would you code the solution?

If not, can you tell me how you would solve this problem and how to code the solution?

James K
Flowing Fount of Yak Knowledge

3744 Posts

Posted - 10/08/2013 :  12:58:57  Show Profile  Reply with Quote
I think you can use only one dataset in a control on a detail line. One possible solution is to create a third dataset which returns the correct data (via changes in the underlying query) based on the parameter passed to the query.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 10/08/2013 :  13:40:11  Show Profile  Reply with Quote
you can use two datasets but you'll need to apply some kind of aggregation or some kind of lookup logic if you want to use them within the same container row.It really depends on your scenario. If you can elaborate more on what you're after that would be great.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

jassie
Constraint Violating Yak Guru

308 Posts

Posted - 10/08/2013 :  13:46:46  Show Profile  Reply with Quote
Can you show me sql that will accomplish the following result:
"One possible solution is to create a third dataset which returns the correct data (via changes in the underlying query) based on the parameter passed to the query."?
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3744 Posts

Posted - 10/08/2013 :  14:24:24  Show Profile  Reply with Quote
What I meant by "a third dataset" can be explained using an example like shown below. Assume your first dataset returns results from a query like shown in 1 below and the second set returns data from a query liek shown in 2. Then, create a third data set like shown in 3 below and use that. The @choice parameter will be populated using the SSRS variable.
-- 1
SELECT co1l1,col2 FROM Table1

-- 2
SELECT col1, col2 FROM Table2


-- 3
IF @choice = 1 THEN
BEGIN
	SELECT col1, col2 FROM Table1
END
ELSE
BEGIN
	SELECT col1, col2 FROM Table2
END

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 10/08/2013 :  23:58:39  Show Profile  Reply with Quote
In that case you could dispense with first two datasets right? Now that you've merged queries onto third dataset the other two doesnt have any relevance

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000