Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Total a Sum Field? Post Reply Post New Topic
Author Message
hugo69
Groupie
Groupie


Joined: 15 Feb 2010
Online Status: Offline
Posts: 53
Quote hugo69 Replybullet Topic: Total a Sum Field?
     Posted: 07 Mar 2010 at 12:38pm
Is there a way to total a sum field? This is what I have.
 
First Formula - Serving Out Of County-1
if {Audit_Trail.FieldName} = "In_This_Facility"
and {Audit_Trail.DateStamp} <= {?date}
or  ({Audit_Trail.FieldName} = "Curr_Cell_Number" and {Audit_Trail.AfterValue} = "Serving Out of County")
and {Audit_Trail.DateStamp} <= {?date}
then ({Audit_Trail.FieldName} = "Curr_Cell_Number" and {Audit_Trail.AfterValue} = "Serving Out of County")
 
Second Formula-Serving Out Of County-2

if {@Serving Out Of County-1} = true then 1 else 0

It gives me the value of 1.
 
Then I create a new formula.
if sum ({@Serving Out Of County-2}) =[1,3] then 1 else 0
 
I put this then in the Group Footer.
 
 
Now I want to sum all the values of 1 from the new Formula Sum in the Group Footer and put the total of all in the report footer.
 
This this possible?
 
 
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Mar 2010 at 7:16am
Why the logic of...if sum ({@Serving Out Of County-2}) =[1,3] then 1 else 0...?
IP IP Logged
hugo69
Groupie
Groupie


Joined: 15 Feb 2010
Online Status: Offline
Posts: 53
Quote hugo69 Replybullet Posted: 08 Mar 2010 at 12:35pm
If the sum would be odd numbers. I just did not put all odd numbers in, just testing 1 and 3 to see if it worked and it did. If the number is odd then I then would change it to 1 and get that sum of the change.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Mar 2010 at 12:55pm
Well in theory the follwing would work.
Use the INsert Summary Function on FOrmula 2 set to change on group1
(basically what your
Create a Running Total
Name=OddCount
Field to Summarize=Field you are grouping on
Type of SUmmary=DistinctCOunt
Evaluate=Use a formula
Sum ({@ServingOutOfCOuntry2}, {table.grooupedOnField}) Mod 2 = 1
Reset=Never
Place on ReportFooter.
 
 


Edited by DBlank - 08 Mar 2010 at 12:55pm
IP IP Logged
hugo69
Groupie
Groupie


Joined: 15 Feb 2010
Online Status: Offline
Posts: 53
Quote hugo69 Replybullet Posted: 08 Mar 2010 at 1:33pm
How would that select the odd number and then total?
 
Insert summary has:
 
group 1 = 3
group 2 = 4
group 3 = 1
group 4 = 7
 
Report Total should be 3 then correct? This would be from:
Sum ({@ServingOutOfCOuntry2}, {table.grooupedOnField}) Mod 2 = 1
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Mar 2010 at 1:36pm

YOu use a Running Total to count the distinct instances of your group.

If you set it to aevaluate all of the records it would give you 4 but if you use the fomrula for evaluation
...
Sum ({@ServingOutOfCOuntry2}, {table.grooupedOnField}) Mod 2 = 1
...
It only evaluates the ODD values.
Make sense?
IP IP Logged
bkvgl
Newbie
Newbie
Avatar

Joined: 08 Mar 2010
Location: Vietnam
Online Status: Offline
Posts: 1
Quote bkvgl Replybullet Posted: 09 Mar 2010 at 12:17am
I want to total mark field, but excepting a record and put summary in Group Header like this:

Name                                     |                   mark       |
-----------------------------------------------------------------
Room1(group header)           |                       8          |   (5+4+7)-4
-----------------------------------------------------------------
duy                                        |                       5         |
anh                                        |                       4         |
tran                                       |                       7         |
-----------------------------------------------------------------
Room2(group header)           |                     15         |
-----------------------------------------------------------------
a                                            |                      7
b                                            |                      3
c                                            |                       8

Please help me,Please use fomular C#
try to best!!!
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