Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Shared variable detail section Post Reply Post New Topic
Author Message
rlassalle
Groupie
Groupie
Avatar

Joined: 09 Aug 2012
Online Status: Offline
Posts: 57
Quote rlassalle Replybullet Topic: Shared variable detail section
     Posted: 09 Aug 2012 at 10:55am
I have a report and sub report where I am brining over a shared variable. I have included the sub report in the details section of the main report. I am using the shared variable value. I need the details section, that show the same value that in the detail section of the subreport.
The variable value comes over into the detail section of the main report is the value of the last record in the subreport and it is the same over each record in the main report detail section.
I need to use the field value from the sub report into the main report as a column in de detail section.
 
Thanks 
 
R  Smile
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 10 Aug 2012 at 4:48am
You don't actually say what your issue is, so I'm going to assume that the problem is that the variable keeps returning the same value.  Is that correct?
 
How are you initializing the variable in the main report and how are you calculating it in the subreport?
 
-Dell


Edited by hilfy - 10 Aug 2012 at 4:51am
IP IP Logged
rlassalle
Groupie
Groupie
Avatar

Joined: 09 Aug 2012
Online Status: Offline
Posts: 57
Quote rlassalle Replybullet Posted: 10 Aug 2012 at 10:19am
Sorry I wasn't clear, but you assume well. Yes the variable return the same value for all records and it is the value in the last record in the sub report.
The value is a product of  a formula result is showed in the subreport which is a already created report, that I use as a subreport.
In the main report I paste the formula with the shared variable that bring the value from the sub report eg. main_inb
Whileprintingrecords;
Shared numbervar inbTos;
inbTos
 
In the sub report,
 
Whileprintingrecords;
Shared numbervar inbTos;
Global numbervar nTOS;
inbTos := nTOS
(This value come from another formula that calculate the TOS in the subreport and is showed in the detaile section with a diff value for each record)
eg
 rec1 00:59:04
 rec2 02:04:50
 rec3 01:02:75
etc.
 I want to see the same values in the main report.
 
Thanks
 
-R-
 
 
 


Edited by rlassalle - 10 Aug 2012 at 10:20am
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 10 Aug 2012 at 12:21pm
1.  You can only get back a single value - the one that is in the last record of the subreport.
 
2.  Create a formula in your subreport to initialize the value of the shared variable:
 
Shared NumberVar inbTOS :=0;
 
NOTE:  this formula should return a blank value.
 
3.  Place this formula in the first unsuppressed section in the subreport.  If that's a detail section, unsuppress a report header, put the formula there and make it very small.
 
Does the formula in which nTOS is calculated return nTOS?  If so, just call the formula when you set inbTOS.
 
-Dell 
IP IP Logged
rlassalle
Groupie
Groupie
Avatar

Joined: 09 Aug 2012
Online Status: Offline
Posts: 57
Quote rlassalle Replybullet Posted: 13 Aug 2012 at 10:42am
Thanks Dell, I tried it, but does not work. Yes the formula return nTOS. In the sub report, I added the formula with the shared variable and I got the same result in both columns. That is correct, but in the main report I put and call the shared variable in the deatil section and I got just single value in each record.
What do you mean with...  call the formula when you set inbTOS. Call the formula in the subreport instead to use a global variable or call the formula in the sub report which calculated nTOS from the main report. Is ti possible to do that?
 
Thanks
 
R


Edited by rlassalle - 13 Aug 2012 at 10:44am
IP IP Logged
rlassalle
Groupie
Groupie
Avatar

Joined: 09 Aug 2012
Online Status: Offline
Posts: 57
Quote rlassalle Replybullet Posted: 15 Aug 2012 at 8:17am
Another question, if some one can help me.  I have two reports, one estatistic for Jun and other Feb. How can make a report with both reports together side by side to be compared, if the both reports have the size that cover the whole wide of the page.
 
Thanks for your help
 
Rodolfo
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 15 Aug 2012 at 8:56am
The only way to do this is using subreports.  However, you can't have a subreport inside another subreport, so it probably won't work with the report we've been discussing.
 
-Dell
IP IP Logged
rlassalle
Groupie
Groupie
Avatar

Joined: 09 Aug 2012
Online Status: Offline
Posts: 57
Quote rlassalle Replybullet Posted: 16 Aug 2012 at 12:32pm
Thanks you Dell
 
 
Rodolfo
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