Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Passing field values from subreport to main report Post Reply Post New Topic
Author Message
moontide
Groupie
Groupie
Avatar

Joined: 23 Feb 2011
Online Status: Offline
Posts: 78
Quote moontide Replybullet Topic: Passing field values from subreport to main report
     Posted: 05 May 2011 at 3:49am
I am working on a report where I am passing a field value from the subreport to the main report through a shared variable. The subreport shared variable is
 
subreport:
DateFormula:
whileprintingrecords;
shared datevar datev := {table1.datefield}
 
 
Main report:
dateformula:
whileprintingrecords;
shared datevar datev;
datev;
 
When i place the dateformula shared variable in the main report detail section, it appears blank. what am i missing here. Why am i not getting any values from the subreport to the main report. Any ideas?
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 05 May 2011 at 5:09am
is the subreport run before or after your formula's location in the detail section?
and does the subreport return a value?

Edited by lockwelle - 05 May 2011 at 5:10am
IP IP Logged
moontide
Groupie
Groupie
Avatar

Joined: 23 Feb 2011
Online Status: Offline
Posts: 78
Quote moontide Replybullet Posted: 05 May 2011 at 9:25am
The formula and the subreport are both placed in the detail section of the main report and if the formula is placed in the detail section of the subreport inside the subreport then the values do show.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 05 May 2011 at 10:26am
just for fun, create a new section to the detail section, below the current section.  Place your formula there.  If it displays values, it is a causality thing...the formula is displayed before the value has come back from the subreport, then it is just a matter of figuring out how to get the subreport to run and the formula to display as desired.
 
If it is still blank, I'm not sure...you might try using a datetimevar instead of the datevar (i've never used this one, but my data fields are all datetime).
 
HTH
IP IP Logged
moontide
Groupie
Groupie
Avatar

Joined: 23 Feb 2011
Online Status: Offline
Posts: 78
Quote moontide Replybullet Posted: 05 May 2011 at 10:37am
Thanks Buddy! I will try it out.
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