How to get working Hours base on Boolean status

Use a transaction group that has an on-change trigger for the boolean or integer of interest. Have the transaction group check the trigger as a pace that meets your accuracy requirements. Then query the database, using a LEAD() window function to look forward from an event to grab the timestamp of the next one. Use an outer query to compute the durations grouped by event value, discarding the grouped rows that aren't interesting.

The insertions into the database can also be scripted if the SQL Bridge module is not installed/licensed.

There are numerous topics on this forum with sample SQL to convert events into durations. Some of these, perhaps:

https://forum.inductiveautomation.com/search?q=%20lead%20downtime%20order%3Alatest

Also, @Shaheryar_Ahmad, you asked this question in another topic:

1 Like