Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Shared Variables Post Reply Post New Topic
Author Message
ofina
Newbie
Newbie


Joined: 19 Jun 2008
Online Status: Offline
Posts: 8
Quote ofina Replybullet Topic: Shared Variables
     Posted: 19 Jun 2008 at 10:42am
I have 2 unlinked subreports on my main report.  Both subreports need to use the same parameters as the main report.
 
I'm trying to avoid my users having to enter the same parameters three times each using shared variables.
 
I have been able to get the parameter values to pass to the subreport doing it sort of backwards from the way that shared variables are intended (passing variables from the subreport to the main report).  But, I can't get the subreport to filter based on those shared variables.  The regular way of filtering based on parameters doesn't work because, other than the fact that my shared variable does not show up in the list of parameters to use, that gets evaluated before the subreport comes across the shared variable call, which is, by definition, whileprintingrecords.
 
I have tried putting my shared variables right into the coding of my fields, using a while...do, but have not been hugely successful.
 
Any thoughts?  Or any other way for my unlinked subreports to use the same parameter information without having to ask for it again?
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 19 Jun 2008 at 11:44am
I'm not sure of the exact question b/c it sounds like the parameters don't work for you and you are using shared variables instead (which don't work either). I think the problem with parameters is that you don't like how the user is prompted for them twice? If so, that is an easy fix and I cover it in Chapter 9 of my Encyclopedia book.
 
When linking the parameter from the main report to the subreport, in the bottom left corner of the linking dialog box, CR gives you a default parameter to link to (that it creates for you). DON'T use this parameter. Instead, click the drop down box and link directly to the parameter in the subreport. This prevents the double-prompting problem.
 
You can find out more about my books at Amazon.com or reading the Crystal Reports eBooks online.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
ofina
Newbie
Newbie


Joined: 19 Jun 2008
Online Status: Offline
Posts: 8
Quote ofina Replybullet Posted: 19 Jun 2008 at 1:03pm

And to think it was that simple.  It seems pretty obvious to me now.  I can't fathom having missed that when I was originally trying it out.  Maybe I just didn't notice that I could drop that box down and pick something other than the default.

Thank you very much.
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 19 Jun 2008 at 3:25pm
Well, you're in good company b/c this question comes up on the forum about once a month. Glad it worked!
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
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