Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: When to use Global or Shared variables Post Reply Post New Topic
Author Message
Cordellv
Newbie
Newbie
Avatar

Joined: 14 Jan 2009
Location: United States
Online Status: Offline
Posts: 35
Quote Cordellv Replybullet Topic: When to use Global or Shared variables
     Posted: 07 Oct 2009 at 6:37pm
Is it good practice to use SHARED variables in a main report to share values  between formulas in the main report or should you always use GLOBAL in the main report and only use a SHARED variable when you are using a sub-report?  That isn't very clear to me in the book.

Edited by Cordellv - 07 Oct 2009 at 8:00pm
Making Things Better One Day At A time
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 08 Oct 2009 at 6:13am
I use shared all the time, because I know if I ever put a subreport into the report, the variables will access it.  Also, I use if for the simple fact, that I want a variable that is seen everywhere (global), which in CR is shared.  In the grand scheme of things, I don't know if this is the most effect use of resources, but it makes it that much easier for me to remember.
 
Just my thoughts.
IP IP Logged
Cordellv
Newbie
Newbie
Avatar

Joined: 14 Jan 2009
Location: United States
Online Status: Offline
Posts: 35
Quote Cordellv Replybullet Posted: 08 Oct 2009 at 6:32am
Just puzzles me that most of the books show examples of GLOBAL.  I have been teaching it that way in my classes but a someone challenged me on it.  I guess I need to change and teach that SHARED is better than GLOBAL.  I hate it when the student is right ha ha ha....   Thanks for your input. 
Making Things Better One Day At A time
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 08 Oct 2009 at 6:54am
Well....I hate that CR called Global, and it is not truly global...shared is.  I try to avoid subreports, so shared and global become the same, as there is no boundary to cross...just easier for me to remember.
IP IP Logged
Cordellv
Newbie
Newbie
Avatar

Joined: 14 Jan 2009
Location: United States
Online Status: Offline
Posts: 35
Quote Cordellv Replybullet Posted: 08 Oct 2009 at 3:06pm
Lockwelle,
I discovered today by reading my SAP CR Report Design III book  that if you use the repository you can save Custome Functions in the repository and then use them in other reports so there is one instance where you could use a variable between reports.  (page 5-3) But you can put LOCAL, SHARED or GLOBAL in a Custom Function.  But we dont use the repository feature so that still does not settle the question. Thanks for taking the time to share your thoughts with me.  Cvail
Making Things Better One Day At A time
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum