Skip to Content
Former Member

# A summary has been specified on a non-recurring field. on a formula

Hello every one,

This is my problem I need to check if the next record/field is equal to the record I'm reading then need to be 0, I evaluated what type of fruit first then record number 12345 example:

numbervar countop;

if {slro.fruit } > 15000 and {slro.fruit } < 22500 then

if previous({slro.fruit}) = {slro.fuit} then countop:=-1 else 0

else countop:=0;

countop

a apple 12345 1

b apple 12345 0

c apple 12345 0

d apple 67890 1

e apple 67891 1

f apple 67892 1

But I get and error A summary has been specified on a non-recurring field on a formula,,, Why?

Any help is welcome Thank you.

##### Add a comment
10|10000 characters needed characters exceeded

### 1 Answer

• Former Member
Posted on Sep 13, 2011 at 06:58 PM

It masy be because you can not summerize any formula containing previous(field) , and by extention, next(field).

or you may need to trick crystal with:

```numbervar countop;

if {slro.fruit } > 15000 and {slro.fruit } < 22500
then
if previous({slro.fruit}) = {slro.fuit} then countop:=-1 else
else countop:=0;

if IsNull({slro.fruit }) then countop else countop```

Debi

Edited by: Debi Herbert on Sep 13, 2011 2:58 PM

Edited by: Debi Herbert on Sep 13, 2011 3:01 PM

##### Add a comment
10|10000 characters needed characters exceeded
• Former Member Former Member

Running total is your only option...

Here are my notes on the 3-formula system for running totals

////// 11/30/2010 {@z..RT three formula sample}

```//// {@RT.varname.1.zero.hdr}
////  will set the variable to zero each time it prints on the report
////  do not suppress-set to font color white to hide
////   place in report header if only calculated once per report
////   else place in group header - must be above the
////RT.*. sum position
////     when put in group header, The group header
////     CAN NOT be set to print on
////     each page because it will zero the field on each page.
////     unless you conditionally suppress this formula
////     with "inrepeatgroupheader"

//// ----you might put this in a goup header to reset it at the
////      beginning of each group for a group total.
whileprintingrecords;
numbervar varname := 0```

```//// {@RT.varname.2.sum}
//// sums each time it prints
////  place in group section with field to be summed
////  do not suppress-set to font color white to hide

whileprintingrecords;
numbervar varname;
//////-----three samples of summerizing data-----\\\\\\
// varname := varname + {field to be summed};
// varname := varname + 1;
// varname :=if field="value" then varname + 1 else varname+0;

///// -----yours might be put in the detail line where you calculate countop
varname=varname+<name of formula calculating countop> ```

```//// {@RT.varname.3.display.ftr}
////       prints the {@zRT.*.2.sum} value at the time is it printed
////       with out affecting the total
////       place below the {@zRT.*.2.sum} where you want it to display

numbervar varname; varname```

I use the variable name in the field name so I can remember which fields are related when I have multiple running totals.

And you may need a second set of RT formulas OR MORE if you want multiple group totals and report totals.

Debi

Edited by: Debi Herbert on Sep 13, 2011 3:57 PM

### Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.