Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Passing Parameters from sub report to main report Post Reply Post New Topic
Author Message
shwetha
Newbie
Newbie


Joined: 13 Oct 2010
Online Status: Offline
Posts: 3
Quote shwetha Replybullet Topic: Passing Parameters from sub report to main report
     Posted: 13 Oct 2010 at 2:13am
Hi ,
 
Can any one help me with the following problem?
 
I have a main report consisting of 36 subreports(on-demand). the selection criteria for main report is not available to subreports.
 
i tried passing parameters by 'changing sub report links'. It doesn't seem to work.
 
the query of main report is as shown
'Select * from view A
where
(A.Business_Unit in ({?BusinessUnit})
And A.Company IN ({?Company})
And A.Location IN ({?Location})
AND A.fl_Manager IN ({?xManagerOrg})
AND A.[Function] IN ({?mFunction}))
And A.Performance_Year = {?PerformanceYear}'
 
 
the query of subreport is
'Select * from view a
where a.Overall_How = 'CE'
And a.Overall_What = 'U'
 
the main report has the parameters mentioned in the query of main subreport.
 
no parameters is created in subreport since it creates while changing subreport link.
 
eg:
though the selcetion criteria is only for few locations according to the main report query, the subreport is showing data for all locations
 
how do i fix it?
 
Please help.
 
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 13 Oct 2010 at 3:24am
add the needed criteria as a parameter in the subreport, then link to it.  There is no variable in teh subreport for location
 
HTH
IP IP Logged
shwetha
Newbie
Newbie


Joined: 13 Oct 2010
Online Status: Offline
Posts: 3
Quote shwetha Replybullet Posted: 13 Oct 2010 at 6:10pm
Thank you.
Could you explain a little more in detail?


Edited by shwetha - 13 Oct 2010 at 6:10pm
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 14 Oct 2010 at 3:39am
in your subreport, you should have parameters for the location...otherwise, it will never filter by location...it will return all locations.
 
once there is a parameter for location, then in the main report, select the change subreport links, and select the location field in the main report to match the subreport parameter for location.  Now it should filter and be linked to the main report.
 
HTH
IP IP Logged
shwetha
Newbie
Newbie


Joined: 13 Oct 2010
Online Status: Offline
Posts: 3
Quote shwetha Replybullet Posted: 19 Oct 2010 at 6:04pm
Thank you.
 
It now seems to work after i added parameters if i don't verify database. But if i verify database it shows error message - 'Syntax error or access violation' . What might be the reason?
 
The parameters of both main report and subreport are of same names and linked using change sub report links.
 
Upon verifying database , it doesn't work.
IP IP Logged
Printable version Printable version

Forum Jump
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