Report Design
 Crystal Reports Forum : Crystal Reports .NET 2003 : Report Design
Message Icon Topic: Initializing variables Post Reply Post New Topic
Author Message
charlese
Newbie
Newbie


Joined: 21 Apr 2011
Online Status: Offline
Posts: 33
Quote charlese Replybullet Topic: Initializing variables
    Posted: 03 Jun 2011 at 2:01am
Hi everybody,

I have got a report which has a group header and footer. Because group footer do not get printed on every page, I created a page footer to display some fields which I am trying to read from the group footer.

So, I have got a formula, a1, which I have put in my group footer which basically read a value from the table and put it into a shared variable, as shown below

Shared StringVar SC_CkNum := "" ;
SC_CkNum := {SuperCheck.CkNum}

What I need to do is to pass the value of this variable to to the page footer. So in my page footer I have created another formula @Reada1, which reads

Shared StringVar SC_CkNum ;
SC_CkNum;

The problem I am having is if the value of SC_CkNum in the group footer is 41234, the @Reada1 formula in the page footer is reading correctly 41234. However if its next value is blank, the @Reada1 formula is still holding on to the old value i.e 41234 and not displaying blank.

Can someone please help me
[IMG]smileys/smiley19.gif" align="middle" />
IP IP Logged
Dewald
Groupie
Groupie
Avatar

Joined: 02 Jun 2011
Location: South Africa
Online Status: Offline
Posts: 47
Quote Dewald Replybullet Posted: 03 Jun 2011 at 2:14am
Two things you can try.
1. Change the Shared Variable to a Global Variable.
2. Do a ISNULL check. NULLS gets ignored.
 
Dewald Botha
http://www.ITClarity.co.za
IP IP Logged
charlese
Newbie
Newbie


Joined: 21 Apr 2011
Online Status: Offline
Posts: 33
Quote charlese Replybullet Posted: 03 Jun 2011 at 2:59am
Dewald

Try both of your suggestion but still not working.
IP IP Logged
Dewald
Groupie
Groupie
Avatar

Joined: 02 Jun 2011
Location: South Africa
Online Status: Offline
Posts: 47
Quote Dewald Replybullet Posted: 03 Jun 2011 at 3:14am
If the value you are reading into the variable is in the details section you would need to put your formula into the detail section.
 
Just tried it and it worked for me.
Dewald Botha
http://www.ITClarity.co.za
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 03 Jun 2011 at 3:23am
In a report without subreports, Shared and Global variables are the same.
With subreports, shared can access variables in teh subreport, Global cannot.
 
As mentioned in your other post, reset the variable in group header, this way if there is not a value in the group footer, or the group footer has not been displayed yet the value reporting in the page footer will be accurrate.
 
If the value is being constantly updated in the detail section...or that is what you want, then as Dewald noted, the formula should be in the detail section.   If the value is blank in the detail section, or it has been blank for all values in the group, or is blank on the last row of the group (which is what your formula is looking at) then you would need to check if it null (as Dewald suggested) and then acting accordingly
IP IP Logged
charlese
Newbie
Newbie


Joined: 21 Apr 2011
Online Status: Offline
Posts: 33
Quote charlese Replybullet Posted: 03 Jun 2011 at 3:30am
I am reading a value from the group footer section and putting its into the page Footer section.

In Group Footer I have formula @a1 as :

Global StringVar SC_CkNum := "" ;
SC_CkNum := {SuperCheck.CkNum}

and in Page Footer I have formula @Reada1 as :

Global StringVar SC_CkNum ;
If IsNull({@a1}) then
    SC_CkNum := ""
else
    SC_CkNum

IP IP Logged
Dewald
Groupie
Groupie
Avatar

Joined: 02 Jun 2011
Location: South Africa
Online Status: Offline
Posts: 47
Quote Dewald Replybullet Posted: 03 Jun 2011 at 3:32am
Maybe post a sample of the data.
Dewald Botha
http://www.ITClarity.co.za
IP IP Logged
charlese
Newbie
Newbie


Joined: 21 Apr 2011
Online Status: Offline
Posts: 33
Quote charlese Replybullet Posted: 03 Jun 2011 at 5:57am
Have you got an email address I can send you my report for you to have a look please ?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 03 Jun 2011 at 8:09am
I'm sorry but I only provide assistance through the forums.
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.