Solved

Global Variables

Posted on 2004-09-22
6
4,688 Views
Last Modified: 2009-09-07
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
0
Comment
Question by:cswebdev
6 Comments
 
LVL 10

Expert Comment

by:ebolek
Comment Utility
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
 

Author Comment

by:cswebdev
Comment Utility
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
 
LVL 28

Accepted Solution

by:
bdreed35 earned 500 total points
Comment Utility
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:cswebdev
Comment Utility
Thanks so much, this worked on the first try!!!!
0
 

Expert Comment

by:mrakolle
Comment Utility
I have formula sitting on my sureport, I need the resukts of this formula to be printed on my main report

please help
0
 
LVL 28

Expert Comment

by:bdreed35
Comment Utility
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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now