Solved

# Crystal Reports - storing values from first and last record

Posted on 2005-03-24
Medium Priority
426 Views
I have an application reads and prints fuel records from a ADO dataset (push method).  Each record contains an  odometer reading.  At the end of each group (vehicle unit), I need to be able to calculate the miles used buy subtracting the starting odometer reading from the ending odometer reading.

My problem is that I cannot figure out how to store the odometer reading from the first and last record of the group for this calculation.

I have considerd passing the miles traveled as a parm but I would have to pass in an amount for each unit ... and that could get real messy.

I also examined some of the totaling options and have tried but to no avail.

HELP!
0
Question by:robertjmackay
• 3
• 2

LVL 101

Expert Comment

ID: 13622858
Use formulas and variables.

Name - InitMiles
Formula
Global NumberVar StartMiles := {OdometerField};

In the group Footer
Name - CalcMiles
Formula
Global NumberVar StartMiles;

{OdometerField} - StartMiles

That should calculate the value you want.

mlmcc
0

Author Comment

ID: 13623252
Didn;t work
InitMiles - placed in the group header contains the value of the first odometer reading
CalcMiles - placed in the group footer is 0.00

I assumed that the formula for CalcMiles contained 2 lines on the formula - 1st to define StartMiles and the 2nd do the subtract calculation

My formulas look like this

InitMiles
Global NumberVar StartMiles := {fuel.fuelodometer};

CalcMiles
Global NumberVar StartMiles;
{fuel.fuelodometer} - StartMiles
0

LVL 101

Accepted Solution

mlmcc earned 2000 total points
ID: 13627479
Add WhilePrintingRecords to the beginning of each formula

InitMiles
WhilePrintingRecords;
Global NumberVar StartMiles := {fuel.fuelodometer};

CalcMiles
WhilePrintingRecords;
Global NumberVar StartMiles;
{fuel.fuelodometer} - StartMiles

mlmcc
0

Author Comment

ID: 13634538
thanks, that done the trick ... appreciate the quick response
0

LVL 101

Expert Comment

ID: 13634636

mlmcc
0

## Featured Post

Question has a verified solution.

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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
###### Suggested Courses
Course of the Month12 days, 19 hours left to enroll