 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.

10|10000 characters needed characters exceeded

### Related questions

• 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

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
////     CAN NOT be set to print on
////     each page because it will zero the field on each page.
////     unless you conditionally suppress this formula

//// ----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