Groups | Blog | Home
all groups > sql server reporting services > june 2005 >

sql server reporting services : pass data between two datasets


Ramani
6/15/2005 11:01:06 AM
Is there anyway i can pass data between two datasets

ex:
dataset 1 has
select empid, fname,lname ,salary from employee

dataset2 has
select userid ,total/(dataset1.salary) from anothertable

here i want to use a value from dataset 1 in dataset 2.

Ramani
6/15/2005 11:20:05 AM
Sub reports ? but i dont want to go into the front end. i want to do it in
the backend itself.
you know pass data from one data set to another directly

Thanks

[quoted text, click to view]
Bruce L-C [MVP]
6/15/2005 1:13:59 PM
Look into using subreports.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

Bruce L-C [MVP]
6/15/2005 1:40:14 PM
You can embed a sub report into the table of the first report passing it the
value from the field of the first one (the subreport should have a
parameter).

There is no way from within RS to tie one dataset to another. Either use
subreports or put the logic in a stored procedure (but since a stored
procedure can only return a single resultset, or rather RS will only use a
single resultset from a stored procedure) I don't think a stored procedure
will work for you.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

Chris McGuigan
6/16/2005 1:14:10 AM
Ramani,

You really need to get all the data you want for a data region into one
dataset. You need to redo the query, there must be a relationship
between ds1 and ds2, or if it's just a continuous list of data try the
Union command.
Sub-reports require much greater overhead it's better not to use them
in this scenario.
Maybe try something like this;
Select e.empid, e.fname, e.lname, e.salary, a.userid, a.total
from employee e
join anothertable a on e.empid = a.userid

It may generate lots of repeated data, but RS can deal with this much
more efficiently than using sub-reports.

Chris


[quoted text, click to view]
Jeff Metcalf
6/16/2005 11:10:19 AM
Easiest way may be to create a view between the 2.

[quoted text, click to view]
AddThis Social Bookmark Button