Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Scope of Running Totals Post Reply Post New Topic
Author Message
bryanlw123
Newbie
Newbie


Joined: 01 Apr 2011
Online Status: Offline
Posts: 14
Quote bryanlw123 Replybullet Topic: Scope of Running Totals
     Posted: 03 Feb 2012 at 11:53am
I want to use a running total found in the details section in the Group Header 2 levels above. The RT counts the number of events in the details section and I want that total displayed in group header #2. The problem is, I only get the first value when I want the last value. The RT counts, evaluates each record and resets on change of the field.
Thanks for your help!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Feb 2012 at 12:53pm
Running totals only work in details or footers. Count(field,group field) can work in a header
IP IP Logged
bryanlw123
Newbie
Newbie


Joined: 01 Apr 2011
Online Status: Offline
Posts: 14
Quote bryanlw123 Replybullet Posted: 06 Feb 2012 at 3:23am
The problem with Count(field, group field) is that I am suppressing some details based on user input (via parameter field), so the Count() function is adding the suppressed fields into the count. I need to use RT but get the total prior to going to the next group.
Thanks for your help!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 Feb 2012 at 3:48am
you can maybe use formual fields that use your params to creaet a value in the formula field that would be counted or summed.
if not(param suppression criteria met) then field
IP IP Logged
bryanlw123
Newbie
Newbie


Joined: 01 Apr 2011
Online Status: Offline
Posts: 14
Quote bryanlw123 Replybullet Posted: 06 Feb 2012 at 3:59am
This is from the Details suppress formula:
Global NumberVar suppressedCount := 0;

if {Command.BUNO} in {?SelectedBUNOs} then
    false
else
(
    suppressedCount := suppressedCount + 1;
    true;
)
and this is from the GH2 display formula:
Global NumberVar suppressedCount;

Local NumberVar numberEvents := {#RTotal3} - suppressedCount;

Local StringVar numberEventsStr := ToText(numberEvents, 0) + ' occurrence(s)';

I still get "1 occurrence(s)". Does this problem stem from a timing issue between the execution time of the details and the GH2?


Edited by bryanlw123 - 06 Feb 2012 at 4:14am
Thanks for your help!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 Feb 2012 at 4:15am
variable formulas are the same as RT's and do not show totals in headers.
 
make a formula called UnsuppressSum (or whatever)
if NOT({Command.BUNO} in {?SelectedBUNOs}) then 1
 
then do a Sum(@UnsuppressSum, groupfield)
 
If you have row duplication issues there are tricks around that too.

 


Edited by DBlank - 06 Feb 2012 at 4:15am
IP IP Logged
bryanlw123
Newbie
Newbie


Joined: 01 Apr 2011
Online Status: Offline
Posts: 14
Quote bryanlw123 Replybullet Posted: 06 Feb 2012 at 4:32am
Thanks,

I had to change the logic to:
if ({Command.BUNO} in {?SelectedBUNOs}) then
    1
else
    0;
to get the correct total but this worked and it now seems rather straight forward. I didn't have to insert the formula into the report for this to work but I guess that the use of this formula in the display formula accomplished the same affect.

You da man!!!

Edited by bryanlw123 - 06 Feb 2012 at 4:36am
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