cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Debi,

Thank you for your reply, any idea how to accomplish this? on other words if the next record is the same I need to go to the next different record?

Former Member
0 Kudos

Try this first and see if it will workk:

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;
 
if IsNull({slro.fruit }) then countop else countop

if it is not the previous function causing the problem, it may work.

Otherwise you may have to do a running total.

Former Member
0 Kudos

unfortunately does not work also I try running total but I have groups and I don't know how to reset to 0 when start a new group, running total seem to work except for the groups.

any other idea?

Former Member
0 Kudos

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