Jump to content

How can I get data from the previous record?


dylan

This topic is 8669 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have a database which calculates times for a motor race. The unique fields are passing time and car no. I calculate everything from these.

Some calculations (eg time between two cars) I do by subtracting a value in the current record (eg passing time) from its value in the previous record.

What's the best way to do this? Can I use the "AutoEnter from Last Record" feature? I'm importing 100 records at a time, so I'm not creating new records here.

What I've done for now is to write a script that works through all the records and cuts and pastes values from one record to the next. This works well and gives correct results. However, I would like to speed it up. For a 2 hour race, my calculations take 2 minutes - not much good if I want to publish updated times on the web every 30s.

Any suggestions would be very much appreciated.

Link to comment
Share on other sites

If you ALWAYS want to find the time between two records in entry order, this will work:

Define Fields:

Record# = Status(CurrentRecordID)

Last Record# = Record# - 1

Time

Define Relationship with same file (call relationship "LastCar"):

Last Record# matches Record#

Define Field:

Elapsed Time = Time - LastCar::Time

Again, as long as you want the elapsed time to be between records in creation order, this will work. If you want to differentiate by Car# or something, you must build a more complex relationship. -bd

Link to comment
Share on other sites

This topic is 8669 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.