Jump to content

Calculation based on previous record


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

Recommended Posts

  • Newbies

I am new to the forum and I am trying to set up a calculation where I enter the current hour meter reading and it will display the hours run since the last record's current reading.

How can I reference the previous record's entry?

Thanks

Nverted

Link to comment
Share on other sites

[Read the last bit first]

I think there might be a built in function for this but I experimented to see if a relationship would work. It does. You need two calculation fields, result Number:

RecID :)

Get ( RecordID )

and PrevRecID :)

Get ( RecordID ) - 1

and then just create a relationship based on those two (I got it the wrong way round at first). As record IDs are allocated in record creation order then this would give you access to all the fields in the previous record. If you replace the - 1 with a '- ' it could make the data to any previous record available in the current record.

What happens if the previous record got deleted?

What happens if the previous record is blank?

Experimented some more and there is an easier way without the need to create a relationship. Just use this:

Prev Reading :)

GetNthRecord ( Meter Reading; Get ( RecordID ) - 1)

I'd read about GetNthRecord but didn't understand it till your question got me to use it. Thanks,

Norman

Link to comment
Share on other sites

This topic is 5786 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
 Share

×
×
  • Create New...

Important Information

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