Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: group footer running total shared boolean Post Reply Post New Topic
Author Message
mrtj
Newbie
Newbie


Joined: 26 Mar 2013
Online Status: Offline
Posts: 26
Quote mrtj Replybullet Topic: group footer running total shared boolean
     Posted: 25 Oct 2013 at 4:57am
In a group footer formula I want to display how many detail lines had the text
'JTC"
or
"GSS"
However if a group has both, I only want to count one of the two.
So I figured a shared boolean variable - cleared out in the group header to false and set to true on a detail line would suffice.

groupheader formula
shared booleanvar x:=false

detail line formula
shared Booleanvar x;
whileprintingrecords;
if {Program_Code}="GSS" then x:=true
x;

groupfooter formula - running total formula - reset at each group
shared Booleanvar x;
whileprintingrecords;
(x=false and  {Program_Code}='JTC')
    or
{Program_Code}='GSS'

The issue is the JTC records are not being counted in this last x=false code. When I remove the "x=false and" part of the formula it counts those JTC records, when I leave it in it does not count those records.

I have printed the value of "X" next to this running total inside the groupfooter, and it prints out the word false, so why isn't this working.

My hunch is the "x=false and {...."    is not written correctly


Edited by mrtj - 25 Oct 2013 at 4:59am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 25 Oct 2013 at 7:02am
typical solution is:
if {Program_Code} = "GSS" or {Program_Code}="JTC" then
1
else
0;

this would be a formula in details
then in the group footer you would sum on the formula for the group.

I am not sure why would have the x=false in the group footer...since the footer only looks at the last record in the group...so I am not quite sure how this is counting the number of occurrances.

HTH
IP IP Logged
mrtj
Newbie
Newbie


Joined: 26 Mar 2013
Online Status: Offline
Posts: 26
Quote mrtj Replybullet Posted: 25 Oct 2013 at 8:21am
thank you.
The GSS records get counted multiples. Ie if youth has 2 GSS records his running total is a 2, if hehas a 2 JTC  records he wont get the extra one coutned
so your 1 or 0 wont work but with my own variation I got it to work.

now a simple pie chart showing
JTC within overall total of "jtc/gss"

I have 2 totals in my report footer 1 from a formula, the other from a running total
I need to divide 21/309

the 21 would be the pie of the chart.
charts wizard is over my head, i dont understand


Edited by mrtj - 25 Oct 2013 at 8:35am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 25 Oct 2013 at 10:29am
alas, never done charts so I am no help there...
Maybe someone else?
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