Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Global variable

Status
Not open for further replies.

mesree

Programmer
Oct 4, 2002
10
IN
I would really like to get some information regarding declaring variables as "Global". I am trying to use a global variable that is incremented at regular intervals while printing the report. The incrementing seems to happen only once.

I have initialized the variable to 1 at the top of the report. then i am incrementing the variable in several sections and displaying the value in the report footer. I have used shared variables, but they don't seem to work properly.

What exactly are global variables. Where all can it be used?
 
Global variables can be used all over your report. They're arguably the most common type of variable, to the point where you don't need to explicitly declare a variable as global. If Crystal is given a variable without a declaration, it will automatically assume that it's global.

The best way for us to get an idea of your predicament is to show us the formulas you're currently using for each step of the variable process, indicating where each formula is executed in the report.

Naith
 
When you say you initialise at top of report. I hope you mean in the report header. If its in the page header it will reset to 1 on each new page.

Where is the global being incremented ? If you are incrementing in a Subreport you must declare and use it as a shared variable.

To debug use your variable display formula alongside your evaluate and see what is happening to it as the report progresses.

Ian Waterman
UK Crystal Consultant
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top