[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2004-11-18
4
Medium Priority
?
7,254 Views
Last Modified: 2009-11-20
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.
0
Comment
Question by:tupac1979
  • 2
4 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 12617823
HAven't used the sum function.

What is wrong with

sum(#countd ,#countd2, #countd3)

or

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

mlmcc
0
 
LVL 28

Expert Comment

by:bdreed35
ID: 12617829
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
 

Author Comment

by:tupac1979
ID: 12617922
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
 
LVL 28

Accepted Solution

by:
bdreed35 earned 500 total points
ID: 12618006
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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month20 days, 2 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question