Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Running Total with StringVar Post Reply Post New Topic
Author Message
ejh21
Newbie
Newbie
Avatar

Joined: 08 Dec 2010
Location: United States
Online Status: Offline
Posts: 8
Quote ejh21 Replybullet Topic: Running Total with StringVar
     Posted: 08 Dec 2010 at 10:30am
Hello,
I'm somewhat new to Crystal Reports so bear with me. I'm trying to create a running total with a character field and then I would like to display that "total"(concatenated string) in the report footer.

I have my data grouped by GroupNum and I only want to display the strings for the second group.

For some reason, the total string only shows the last record in the second group.

Here is an example of my data:

Letter      GroupNum
A                 1
B                 1
C                 1
D                 1
E                 2
F                 2
G                 2
H                 2

I would like to display this in the report footer: "EFGH"

I have a Formula setup with this code that is placed in the report footer.

Here is the code:

WhilePrintingRecords;
Global StringVar Letters;
Letters := Letters + {Letter}


My problem is that the formula only displays "H" in the report footer.

Any help is appreciated.

Thanks,
Erik

Edited by ejh21 - 08 Dec 2010 at 10:31am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 09 Dec 2010 at 3:26am
your formula is fine, but I think it is in the wrong place.  If it is in the group footer that you want to see EFGH in, it will only be run once...on H.
 
if you place it in the Detail Section, it will be run multiple times, and you will need another formula that is just:
global stringvar Letters
 
to be in the group footer.
 
ps If you want to hide the Letters from displaying as the report runs, there are many options, but the one that I use is to place "" at the end of the formula.  Crystal always prints the last thing in the formula...
 
HTH
IP IP Logged
ejh21
Newbie
Newbie
Avatar

Joined: 08 Dec 2010
Location: United States
Online Status: Offline
Posts: 8
Quote ejh21 Replybullet Posted: 09 Dec 2010 at 5:52am
Thank you for your response. That helped. Except now I'm getting these results in the Report Footer: "EFGHH"

For some reason, the last record is showing twice in the total string. Do you what could be causing this?

Thanks again!
IP IP Logged
ejh21
Newbie
Newbie
Avatar

Joined: 08 Dec 2010
Location: United States
Online Status: Offline
Posts: 8
Quote ejh21 Replybullet Posted: 09 Dec 2010 at 6:40am
I finally figured it out. I replaced WhilePrintingRecords with WhileReadingRecords and that did the trick. Thanks for your help!
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