Forum Discussion

ArchiveUser's avatar
ArchiveUser
Qrew Captain
7 years ago

Recount after certain condition is met

Hi all,

I'm trying to compute a certain formula but am unsure of how to do it.

I want to employ a function which will recount from 0 if a condition is met.

For example,

Motor A reaches 25 hours of use.

A separate condition relating to the problem:
Maintenance="Not done" -> continue counting
If Maintenance="Done" -> Recount from 0 from the time edited

Motor A starts counting from 0hours

---repeat

Thanks.
  • you may need to use a few date/time fields to get this correct, but I need more details.

    When does Hours of Use begin calculating time, what does it base its total time off of as a start time?
    Maintenance needs a date time also, as multiple maintenance events can occur.

    var datetime Time = Max( [Start Time],[Maintenance Time])

    tohours(Now()-$Time)

    will provide a duration, you can set to hours as a number
    tonumber(tohours(Now()-$Time) )


    When Start time is 10 am, and it is now 11:15, the number of hours will be 1.
    When the start time is 10 am, and it is now 11 am the next day, the number of hours will be 25.
    When the Maintenance time is 12 pm, and it is now 1pm, the number of hours will be 1.

    You can use form rules to set the start and maintenance time, but some action must set these date/time fields in order for this process and formula to work. 

    Let me know if this helps.
  • Right now, the total time is computed with the addition of a certain log. The Motor page pulls data from the log and tally with the S/N used and sums up the total time used. This process is totally dependant on the logs and it does not follow a certain time-schedule, could be random.

    What i'm looking for is to incorporate a button to restart the counter of that from 0 if a specific maintenance is done and reset it to zero, while still maintaining the total hours used for that particular motor.

    To sum up, it will have a field of "Total Hours" and "Counter",

    where "Total hours" continues to compute, whereas "Counter" resets from 0 if another field "Maintenance Done?" states "Yes".

    Thanks.