Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Global variable Post Reply Post New Topic
Author Message
CrystalT
Newbie
Newbie
Avatar

Joined: 18 Nov 2008
Location: India
Online Status: Offline
Posts: 2
Quote CrystalT Replybullet Topic: Global variable
     Posted: 19 Nov 2008 at 12:57am
Hi All,
 
I have a query regarding global variables.
 
My code is something like this:
 
global numbervar x;
if (Afield)>1 then x:=x+1;
 
I have grouped my records according to a field Bfield. Now the global variable will keep on incrementing for each record evaluation but i want to reset it on start of the next group:
 
For eg: Currently the output is like this:
Bfield value 1
               1
               2
               3
Bfield value 2
               4
               5
               6
 
But i want the output in this way:
Bfield value 1
               1
               2
               3
Bfield value 2
               1
               2
               3
 
Is this possible?
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 19 Nov 2008 at 1:10am
Hi
 
Change the Global keyword to Shared.
 
Shared numbervar x;
 
Then Create a formula to reset the variable
 
Frm_Reset
shared numbervar x;
x:=0
 
Place this in Group Footer
 
Cheers
Rahul
IP IP Logged
CrystalT
Newbie
Newbie
Avatar

Joined: 18 Nov 2008
Location: India
Online Status: Offline
Posts: 2
Quote CrystalT Replybullet Posted: 19 Nov 2008 at 1:16am
Hi Rahul,
 
Thanks a lot.
It worked.
 
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