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 188.8.131.52 had an "issue" with drill downs on subreports with shared variables, so get the v7MR or v8