Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 2 datasets used for same detail line on SSRS 2008

Author  Topic 

jassie
Constraint Violating Yak Guru

332 Posts

Posted - 2013-10-08 : 12:26:13
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
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-10-08 : 12:58:57
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

52326 Posts

Posted - 2013-10-08 : 13:40:11
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

332 Posts

Posted - 2013-10-08 : 13:46:46
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
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-10-08 : 14:24:24
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

52326 Posts

Posted - 2013-10-08 : 23:58:39
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
   

- Advertisement -