tleitzke

Grab information from previous record

Discussion created by tleitzke on Jan 4, 2017
Latest reply on Jan 4, 2017 by philmodjunk

I am creating a gas mile comparison table for our drivers, and to reduce human error, the miles is whatever the odometer says when adding gas at the pump ( and amount of gas added for full tank is how much was used previously). I made a new field in database for storing gas-miles comparisons, but I do not know how I can grab data from the directly previous record (since an automatically created serial key can errors, if an entry is deleted due to human error). what I need that gas-miles number to be is equal to: ($prev = previous entry miles)

 

gas::gaspermile = (gas::miles - $prev) / gas::gas

 

 

yes. I picked horrible names. I am bad with cars to begin with, and couldn't immediately think of better identifications for those fields.

Outcomes