Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Global Variables Post Reply Post New Topic
Author Message
Empeefree
Newbie
Newbie


Joined: 26 Aug 2014
Location: South Africa
Online Status: Offline
Posts: 2
Quote Empeefree Replybullet Topic: Global Variables
    Posted: 26 Aug 2014 at 8:45pm
Formula Fields:

//SetSectionIntro, Set Section to Intro.
Global StringVar SectionName;
SectionName := "Introduction";

//SetSectionRev, Set Section to Revision.
Global StringVar SectionName;
SectionName := "Revision";

//GetSection, returns the section name
Global StringVar SectionName;

The first two formula fields set the value of the global variable and the last formula field return the global variable value when called.

Outline:
My report have 2 group footer sections where I call the SetSection formula in each of the group footers. The global variable is not updating and only reflects the first SetSection call "Introduction".

Report layout:

Report Header
Page Header
Group Header #1
Details
Group Footer #1a
SetSectionIntro
GetSection //Returns the correct value as "Introduction")
Group Footer #1b
SetSectionRev
GetSection //Returns the incorrect value as "Introduction" and should be "Revision"
Report Footer
Page Footer

Any pointers or assistance is greatly appreciated. Let me know if that does not make sense?
IP IP Logged
z9962
Senior Member
Senior Member
Avatar

Joined: 04 Jul 2012
Online Status: Offline
Posts: 161
Quote z9962 Replybullet Posted: 27 Aug 2014 at 12:37am

I am not sure what you are trying to achieve here by using a variable? Why not just use a text box Introduction in GF1a and a second one Revision in GF1b?

IP IP Logged
Empeefree
Newbie
Newbie


Joined: 26 Aug 2014
Location: South Africa
Online Status: Offline
Posts: 2
Quote Empeefree Replybullet Posted: 31 Aug 2014 at 7:55am
Thanks for response z9962. I'm using a stored procedure to write the GetSection value to a database. I've managed to sort with another method.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 05 Sep 2014 at 12:35pm
since the syntax is correct, my thought would be Crystal is calling the Read formula before the Set.

just for fun, you could try making another group footer section and putting the set formula there (suppress the footer so it doesn't show) and then checking if the get formula return correctly....

for next time.

just a thought
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.047 seconds.