Forum Discussion

Re: How to calculate run time from hour meter reading

There are at least 3 easy solutions I can think of as your table are properly laid out.
.
One just uses summary fields.
One uses summary fields and reverse relationships.
One uses the new Combined text summary field and regular numeric summary fields.


I will describe the first solution for now.  It does assume that the meter reading value is a numeric field.

None of these solution involves that self relating relationship. (nothing wrong with doing that in Quick base, but for these solutions we do not need to have that Relationship.

Here we go. One the Relationship for 

One Equipment has Many Reads.

Summary Maximum of the [Read Date] field called [Last Read Date].

Look that up down to the Reads table.

Summary Maximum  of the [Read Value] subject to the filter that the [Read date] = is equal to the value in the field [Last Read Date].  Call it [Last Read Value]. Note that there will only be one Qualifying Read so it can be a Summary Maximum, Minimum or Average.  They will all be the same result. 

Now the Equipment automatically knows the [Last Read Value] so we are half way there.

New summary of the maximum of the Read Date subject to the filter that the Read Date is less than the value in the field [Last Read Date].  Call it [Previous Read Date].  Look that up down to the Reads.

New Summary Maximum  of the [Read Value] subject to the filter that the [Read date] = is equal to the value in the field [Previous Read Date].  Call it [Previous Read Value]. Again, note that there will only be one Qualifying Read so it can be a Summary Maximum, Minimum or Average.  They will all be the same result. 


All done.

Of course, from time to time the Meter will "roll over" so when you subtract your meter readings you may get a negative result and will need to know how many digits in the Equipment Meter in order to calculate the difference.
 
No RepliesBe the first to reply