Joined: 01 Jul 2010
Location: United States
Online Status: Offline
Posts: 8
Topic: 2008 Subreport Posted: 08 Nov 2010 at 6:47am
I'm trying to do this...
I have a two databases.
The first database I have a list of users and dates. Using a date as a parameter, I get a list of users for that day. The second database has a list of billing info for users.
I want to put a parameter in the main report... and for each record in the main report, pull the bill for that user.
SELECT User FROM Tbl_1 WHERE Date = Yesterday
Would it be possible to either have the sub-report ran for each record in the main report?
SELECT Bill from Tbl_2 WHERE User = ?
OR have a list built for a Select * From Tbl2 Where user in ({LIST})?
SELECT Bill from Tbl_2 WHERE User in {List_Of_Users}
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Posted: 08 Nov 2010 at 7:58am
if you place the subreport in either the group section if youa re grouping on the user record or on the detail section if you are not grouping you can simply link the main report to the sub report on the user and it will act as a filter (it will become a param in the sub report).
That being said why are you using a sub report rather than just grouping on the user in tha main report? Sub reports really kill performance.
Joined: 01 Jul 2010
Location: United States
Online Status: Offline
Posts: 8
Posted: 09 Nov 2010 at 5:56am
Without going into a rant or extreme detail... Database2 is dated, slow, basic and very messy to deal with. If I do anything more than basic select statements, the return time increases drastically.
So my goal is to do all the select, joins, case statement on Database1, then for each record in results pull bill from Database2.
Just as an example... Doing the select by date on DB1 takes seconds. A similar select in DB2 (Select users on a couple joined tables where date = yesterday, this in that, etc) takes 10 minutes to run. While "select bill from table where user = ?" is almost instant.
I've tried quite a few things and for some reason the Sub Report doesn't seem to be getting the user as a parameter and I can't seem to figure out why. I'll post more detail shortly about how I've got it setup and maybe something will stand out.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum