INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Types of Variables

What are the different types of variables, and what are the differences? by MalcolmW
Posted: 10 Nov 00

Seagate Crystal Reports Variable Declarations in SCR version 7 and later
SCR v7 and above uses three different scope levels for variables:
+ global
+ local
+ shared.

Global variables
A variable can be declared as
Global NumberVar Test ;
to indicate that this variable uses the same memory block to store a value throughout the main report. The value is available to all formulas that declare this variable, except for those in subreports.  If no scope is indicated, as in
NumberVar Test ;
then SCR will use the default scope of Global.  There is no way to change this default behaviour.
Formulas with Global scope are evaluated at the time specified in the formula, or if no time is specified, then at what SCR understands to be a good time to evaluate the formula. (and if that doesn't convince you to specify the evalution time, nothing will)

Local variables
It is possible to restrict a variable for use within a single formula only. This means that if the same variable is used in another formula, the value assigned in a previous formula will not be carried over. This isolation of variables thus allows many formulas to use the same variable name with no interference from one another. The syntax for declaring this is:
Local NumberVar Test ;
Formulas with Local scope are evaluated at the time specified in the formula, or if no time is specified, then at what SCR understands to be a good time to evaluate the formula.

Shared variables
Since previous versions could not share variables with subreports, Store and Fetch functions were used for passing variable values from a main report to a subreport or the reverse. The shared variable declaration now replaces these functions and simplifies the process of sharing values with subreports. Store and Fetch functions are no longer automatically included during the product installation.
The syntax for declaring this is:
Shared NumberVar Test ;

Formulas with Shared scope are evaluated WhilePrintingRecords.

Releases of SCR v7 prior to 7.0.100.15 had an "issue" with drill downs on subreports with shared variables, so get the v7MR or v8

Back to Business Objects: Crystal Reports 4 Other topics FAQ Index
Back to Business Objects: Crystal Reports 4 Other topics Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close