Solved

# Crystal Reports - storing values from first and last record

Posted on 2005-03-24
Medium Priority
425 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
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 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…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
###### Suggested Courses
Course of the Month14 days, 4 hours left to enroll