### Title

calculating time that a field has been TRUE.

### Post

I have a table with a dateTime, pumpOn GPM etc. etc.

Lets say I have five Records...

dateTime-------------pumpOn---GPM

5/5/15 6:00:00 AM 0 800

5/5/15 7:00:00 AM 1 800

5/5/15 7:15:00 AM 1 800

5/5/15 8:30:00 AM 1 800

5/5/15 9:00:00 AM 0 800

How would I calculate how long the pump has been on? **1.5Hrs**

I've tried searching google for anything on a calculation like this, but I'm not exactly sure what to search for.

thanks in advance for any help.

Actually, it's designed to copy over the time stamp. It's not defined to subtract this value from itself. It will subtract Null from itself.

Let ( [ R = Get ( RecordNumber ) ;

PoPrev = If ( R > 1 ; GetNthRecord ( PumpOn ; R - 1 ) ) ;

Ts1 = If ( PoPrev ; GetNthRecord ( dateTime ; R - 1 ) )

] ;

If ( PoPrev ; DateTime - Ts1 )

) // Let

This assumes that the first time the status changes to "off" from "on", you want to capture one more time interval