Print Page | Close Window

Global vrs Shared variables

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=7951
Printed Date: 19 Apr 2024 at 4:20pm


Topic: Global vrs Shared variables
Posted By: Cordellv
Subject: Global vrs Shared variables
Date Posted: 07 Oct 2009 at 9:26am
I thought you used Global variables when you wanted to share a variable between formulas through out the report and only used Shared Variables when you were using a Sub-report. Some one told me that you should always use Shared Variables and never use Global Variables.  Do you agree?  If that is the case why would Crystal Reports default to Global instead of Shared when you dont declare the scope?
Cvail


-------------
Making Things Better One Day At A time



Replies:
Posted By: BrianBischof
Date Posted: 07 Oct 2009 at 10:18pm
I never heard that Shared takes priority over Global. Did this person give you a reason for it? From a management standpoint, I would think it's takes less resources to manage variables within a single report than across multiple reports. Thus, Global would be the best choice as the default scope declaration. But this is just a guess b/c I never saw anything comparing the performance of the two against each other.

-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>


Posted By: Cordellv
Date Posted: 08 Oct 2009 at 6:43am
Brian,
 
Thanks for your reply.  That was what this person said that GLOBAL can be used across multiple reports.  I have never seen any where that could be the case, even if you use the Repository.  Is that what you are saying that GLOBAL variables can be used between two different reports? 
 
"takes less resources to manage variables within a single report than across multiple reports"
 
I dont see how that could be possible.
 
As for resources, I will have to create a couple of reports, one with GLOBAL variables and one with SHARED variables and see if there is any resource difference.  I will let you know what I find out.
 
Cv


-------------
Making Things Better One Day At A time


Posted By: Cordellv
Date Posted: 08 Oct 2009 at 10:00am

Brian,

I got out my SAP CR class book for Report Design III and found you are right (of course).  You can share a variable between reports by using custom functions and saving them to the repository. 

 

Page 5-3

 

"Custom functions can be shared between reports by storing them to the Business Objects Enterprise repository and adding them to reports as needed"
 

But we don’t use the repository so I was not aware of that.  So there is at least one way a variable could be shared between reports (and I assume that means the actual variable name and the value assigned to it in the custom function).

Cv

 



-------------
Making Things Better One Day At A time



Print Page | Close Window