Answered by:
Two Dataset

Question
-
Hi i am trying to create a report using two datasets.
The first has a user id which i need to link to the second one to pull the information required. Is there anyway i am able to do this. The second dataset query needs the user.id before the query will work
Thanks
- Edited by Phil1988 Tuesday, May 6, 2014 3:23 PM
Tuesday, May 6, 2014 3:21 PM
Answers
-
You can use subreport to achieve this. UserID can be configured as parameter for subreport and link it by passing UserId field as parameter from first report.
Regards,
- Proposed as answer by Simon_HouMicrosoft contingent staff Wednesday, May 7, 2014 2:02 AM
- Marked as answer by Phil1988 Wednesday, May 7, 2014 1:32 PM
Tuesday, May 6, 2014 3:56 PM
All replies
-
You can use subreport to achieve this. UserID can be configured as parameter for subreport and link it by passing UserId field as parameter from first report.
Regards,
- Proposed as answer by Simon_HouMicrosoft contingent staff Wednesday, May 7, 2014 2:02 AM
- Marked as answer by Phil1988 Wednesday, May 7, 2014 1:32 PM
Tuesday, May 6, 2014 3:56 PM -
One way you can do is using subreport as per previous suggestion. If you want to do this inside report you can use Lookup,LookupSet etc functions to do lookup based on UserID value from first dataset and get matching details. But for this dataset2 will return all data for all users by default as filtering happens only inside SSRS report expression
http://www.allaboutmssql.com/2013/08/ssrs-example-for-lookup-lookupset-and.html
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
Tuesday, May 6, 2014 4:52 PM -
This is basically what i need to do
WHERE account_info_UID = 'CD' + userid
but the userid isnt known until Dataset one is run so i was wondering if there was away of delaying dataset2 until dataset1 is run or is there another way todo this
Wednesday, May 7, 2014 10:36 AM -
What do you mean by delaying dataset2 until dataset1 is run ?
Regards, RSingh
Wednesday, May 7, 2014 10:43 AM -
I need information from userid(dataset1) to pull through to this query WHERE account_info_UID = 'CD' + (userid(dataset1)) which is dataset 2
Datset2 is a different query
- Edited by Phil1988 Wednesday, May 7, 2014 11:24 AM
Wednesday, May 7, 2014 10:50 AM -
You can even create another dataset using SQL Join between the two query that you have specified in dataset1 and dataset2.
SELECT * FROM (SELECT * FROM DSQUERY1) A
INNER JOIN (SELECT * FROM DSQUERY2) B
ON A.ACCOUNT_INFO_UID = 'CD' + B.ACCOUNT_INFO_UID
Regards, RSingh
Wednesday, May 7, 2014 12:53 PM -
I have used a parameters to pull the information through and the query works when i put the id in myself but doesn't pull through the information when i execute the query. Is there a way to delay the second query.
Thanks
- Edited by Phil1988 Wednesday, May 7, 2014 1:17 PM
Wednesday, May 7, 2014 12:58 PM -
Have you configured a parameter for passing the value to dataset2?
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
Wednesday, May 7, 2014 1:55 PM -
ye i believe so but the first query needs to be run before the parameter can workWednesday, May 7, 2014 1:59 PM