Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Pass parameter to SubReport Post Reply Post New Topic
Author Message
pellis
Newbie
Newbie


Joined: 09 Mar 2008
Online Status: Offline
Posts: 14
Quote pellis Replybullet Topic: Pass parameter to SubReport
     Posted: 04 Dec 2008 at 1:42pm
Hello All,
I have a bit of a problem and I'm not sure if this is something that can be done.  I do appreciate any help you can give me on this.  I have created a report with 2 subreports.  The main report will have a date range for a column called 'Referral Date'.  One of the subreports will have a date range for  a column Status Date and the other has a date range for a column called Approved Date.  I've created 2 formulas called @startdate and @enddate and also 2 parameters called ?startdate and ?enddate.
 
On the main report for the selection criteria I have a formula
     {Referral Date} >={@startdate} and {Referral Date} <= {@EndDate}
On the first subreport
        {Status date} >={@startdate} and {Status date} <={@EndDate}
On the second subreport
   {Approval Date} >= {@startdate} and {Approval Date} <= {@enddate}
 
I'm not sure what to do next to make it work.  Any help is appreciated.
 
Thanks,
 
PELLIS
IP IP Logged
RitaInHood
Newbie
Newbie


Joined: 07 Jul 2008
Online Status: Offline
Posts: 25
Quote RitaInHood Replybullet Posted: 08 Dec 2008 at 4:17pm
Have you declared the passed parameter as GLOBAL on the main report?
IP IP Logged
pellis
Newbie
Newbie


Joined: 09 Mar 2008
Online Status: Offline
Posts: 14
Quote pellis Replybullet Posted: 09 Dec 2008 at 3:34pm
Thanks for your reply. No, I haven't.  How would I do that? 
IP IP Logged
RitaInHood
Newbie
Newbie


Joined: 07 Jul 2008
Online Status: Offline
Posts: 25
Quote RitaInHood Replybullet Posted: 10 Dec 2008 at 1:24pm
I tend to set up a field to do all declarations & initial value settings, often called "udf.SetVar".  Inside, I put the various declarations, such as:

shared datevar enddate;
shared numbervar ThisNum:=0;

etc.  Note that date variables cannot be set to 0 (tho everyone tries)

When you design the subreport, do your internal stuff, then take the variable you want to pass out of the subreport

shared datevar enddate:= Thisdate;

Back in the main report, and in a section BELOW the one where the subreport was called, put a formula field that simply displays the variable

shared datevar enddate;

Run & confirm you are getting a date out of the subreport.

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