How do I use the correct sum function in crystal report formula editor

I have three fields I developed with formula editor name #countd ,#countd2, and #countd3 how do I use the sum() function to add a field in my report to display the total.
tupac1979Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlmccCommented:
HAven't used the sum function.

What is wrong with

sum(#countd ,#countd2, #countd3)

or

sum({#countd} ,{#countd2}, {#countd3})

mlmcc
0
bdreed35Commented:
Judging by the fact that all 3 fields have a "#" sign in front of the name, it looks like you have created Running Totals.
Running Totals are evaluated while the records are printing and the sum function is evaluated while the records are read so you cannot insert a summary on a running total.
A running total can be set up to sum a certain set of records if you need it to be.
Depending on what your running totals are doing, we may be able to set you up with some simple formulas that will allow for you to insert a summary off of it.
Can you post what your 3 running totals are doing? (field, summary type, how it is evaluating, and when it is resetting)
0
tupac1979Author Commented:
They are running totals and they are setup like this
#count1
 field ADMSTAT.PATID
Evaluating : using the formula
{ADMSTAT.PATSYS} = Previous({ADMSTAT.PATSYS}) OR {ADMSTAT.PATSYS} = Next({ADMSTAT.PATSYS}) AND {ADMSTAT.ADM} = 'P'

Resetting at
On change at group - GROUP1# ADMSTAT.AGENCY

#count2
 field ADMSTAT.PATID
Evaluating : using the formula
{ADMSTAT.PATSYS} = Previous({ADMSTAT.PATSYS}) OR {ADMSTAT.PATSYS} = Next({ADMSTAT.PATSYS}) AND {ADMSTAT.ADM} = 'N'

Resetting at
On change at group - GROUP1# ADMSTAT.AGENCY

 field ADMSTAT.PATID
Evaluating : using the formula
{ADMSTAT.PATSYS} = Previous({ADMSTAT.PATSYS}) OR {ADMSTAT.PATSYS} = Next({ADMSTAT.PATSYS}) AND {ADMSTAT.ADM} = 'P'

Resetting at
On change at group - GROUP1# ADMSTAT.AGENCY

The purpose of these fields is to display the total number of duplicate Patid's and then I want the total number of duplicates

0
bdreed35Commented:
Since you are using the Previous and Next functions, you won't be able to use the sum function.
You have 2 methods to accomplish this.

ONE -
Create a duplicate of each running total and ONLY change the reset to Never.
Place each RT in the report footer, and your done.

TWO-
Create a formula to accumulate the values in the GROUP1# ADMSTAT.AGENCY footer, and then 3 formulas to display the totals at the end.

//@Accum
whileprintingrecords;
numbervar count1 := count1 + {#count1};
numbervar count2 := count2 + {#count2};
numbervar count3 := count3 + {#count3};
""

Place the above formula in the GROUP1# ADMSTAT.AGENCY group footer and suppress it.

//@DisplayCount1
whileprintingrecords;
numbervar count1;

//@DisplayCount2
whileprintingrecords;
numbervar count2;

//@DisplayCount3
whileprintingrecords;
numbervar count3;

Place the above three formulas in the report footer.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.