Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Global Variables

Posted on 2004-09-22
6
Medium Priority
?
4,708 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 10

Expert Comment

by:ebolek
ID: 12127855
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
ID: 12127871
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 2000 total points
ID: 12127874
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
[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

 

Author Comment

by:cswebdev
ID: 12128310
Thanks so much, this worked on the first try!!!!
0
 

Expert Comment

by:mrakolle
ID: 14517383
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
ID: 14518755
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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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 …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

598 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