Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The Summary/Running total Field Could not be created 1

Status
Not open for further replies.

RppDuck

Programmer
Oct 10, 2002
12
0
0
US
I used this example out of a book:

Sum ({tbl_E_C_REQUISITIONS.QTY_NEEDED}, {tbl_E_C_REQUISITIONS.REQ_DATE})

But I get the Error. "The Summary/Running total Field Could not be created"

I saw a reference to a FAQ on Tek-Tips 149-182 but I could not find the FAQ.

The Result I am looking for is How many QTY_NEEDED fall on a Particular date. Date is in DateTime format.

Thank you
 
Are you writing this formula from scratch? If so where are you placing it? In what section of the crystal report?

You do not need to write a formula to do what you are attempting, just right click on the field in question and select 'insert summary'.

Is this what you did or did you write a formula longhand?


Software Training and Support for Macola, Crystal Reports and Goldmine
251-621-8972
dgilsdorf@mchsi.com
 
hi

if you are using a summary field and wanting to do a conditional count on this based on a date, you will need to use manual running totals.

Here is information on how to achieve this.

 



To subtotal WhilePrintingRecords formulas, create a manual running total using formulas that declare and increment a numeric variable.

Running totals can be used as workarounds for other scenarios as well, and are not limited to totalling formula fields. You can also use them to:

· Count records

· Conditionally count or total records

· Total or count records independant of a report's grouping

to name a few examples.

NOTE:=======

If you are using version 7 or higher of CR, note that for the same reasons explained above, the Running Total Expert (which was added in version 7 of Crystal Reports) cannot create Running Total fields on WhilePrintingRecords formulas.

=============

The variable will be initialized in a Header section, incremented in the Details section, and displayed as a result in a footer section. You must create corresponding formulas to initialize the variables, to keep track of the total, and to display the variable.

The example below illustrates a manual running total that subtotals values for a group. In other words, the variable storing the running total value is reset when Crystal Reports reaches a new group header.

To familiarize yourself with Crystal Reports' variable syntax, consult the Crystal Reports - User Guide's chapter on 'Advanced Formulas'

1. Create these three formulas:

@Formula 1

WhilePrintingRecords;
NumberVar RunningTotal;
RunningTotal := 0

@Formula 2

WhilePrintingRecords;
NumberVar RunningTotal;
RunningTotal := RunningTotal + {@formula field}

//Substitute your formula field name for
//{@formula field}

@Formula 3

WhilePrintingRecords;
NumberVar RunningTotal;
RunningTotal;


2. Insert the formulas on the report:

· Place {@Formula 1} in the Group Header section (you can suppress this formula if you want)

· Place {@Formula 2} (or 2a) in the Detail section (you can suppress this formula if you want)

· Place {@Formula 3} in the Group Footer section.

To change how often this running total resets or displays, you can move @Formula 1 and/or @Formula 3 to other sections. For example, to have this running total act like a grand total, move @Formula 1 to the Report Header, and move @Formula 3 to the Report Footer.


3. Once you've verified that all three formulas are returning the correct results, you can suppress {@Formula 1} and {@Formula 2} so the report does not get too cluttered. To do this:

· On the report, right-click @Initialize, and then click Format Field.

· On the Common tab, select Suppress.

· Repeat these steps for @Evaluate.

Suppressing these formula fields will not affect the running total calculations.


To Create a Conditional Running Total

If you want the running total to evaluate only upon a certain condition, modify @Formula 2 as displayed in the formula below:

@Formula 2a

WhilePrintingRecords;
NumberVar RunningTotal;

If {field} = "a certain value"

//Substitute the actual condition that is to be met
//for "a certain value"

then
RunningTotal:=RunningTotal + {@formula field}
Else
RunningTotal:=RunningTotal


To Create a Running Count

To count records, instead of totalling them, modify @Formula 2 as displayed in the formula below:

WhilePrintingRecords;
NumberVar RunningTotal;

RunningTotal:=RunningTotal + 1;


NOTE:=======

For more information on running totals, go to and search for SCR_RunningTotals.zip, which is a paper on 'Everything You Need to Know about Running Totals'.

=============

Please let me know if this helps.
Eileen McEvoy
Crystal Reports Consultant and Trainer
emcevoy@crystalconsulting.ca
 
The reason you probably get the original error, is that you don't have a group on ReqDate. If you are grouped on that date the original formula should work. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top