Global Variables

Hi,

I'm using Crystal 8.5.   I have a report with several subreports.  What I'm needing to do, is to be able to add the totals of a running total field on subreport1, and subreport2 and display the total on subreport2.  I thought I could do this, using global variables, but I'm not having much luck.  Can someone please walk me through this step by step?  Thanks
cswebdevAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
bdreed35Connect With a Mentor Commented:
You need to use shared variables to pass values between a report and one of its subreports.

The basic steps are to create the shared variable in a formula in the main report.

Whileprintingrecords;
shared numbervar accum := 0;

Make sure that you place it in a section that is before any of the subreports.  If you are accumulating the values for a grand total, then the Report Header will do.

Now in each subreport, create a formula that adds to the same shared variable:

Whileprintingrecords;
shared numbervar accum := accum + {#RT subreport1};

Repeat this in each subreport, modifying the Running Total name.

Lastly, in the main report, create one more formula that will displal the variable.  Make sure that you put it in a section after the subreports.

Whileprintingrecords;
shared numbervar accum;

That is the basic structure to get you going.
0
 
ebolekCommented:
If you want to pass info to subreport

Use shared variables

In the main report
Sharedvar total:= 100;

In the subreport
Sharedvar total;

Subreport will show 100
Regards
Emre
0
 
cswebdevAuthor Commented:
You can do this from subreport to subreport?  The main report isn't used for anything except as a holding place for all of my subreports.  
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
cswebdevAuthor Commented:
Thanks so much, this worked on the first try!!!!
0
 
mrakolleCommented:
I have formula sitting on my sureport, I need the resukts of this formula to be printed on my main report

please help
0
 
bdreed35Commented:
Reference the variable in the main report like this:

Whileprintingrecords;
shared numbervar accum;

Put the formula in a section below the one containing the subreport.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.