I have a tag that returns a string value of “Running”, “Paused” or “Stopped”. I’d like to take the delta time between each status change and then sum it to get the total run, pause and stop time.
In some versions of SQL there is a lag/lead function to accomplish this but it doesn’t seem to be present in the Ignition version.
I would switch away from SQLite. It is not a high-volume production database. If you need free, MariaDB and PostgreSQL are both free and support lead/lag.
You can also use a script transform in a binding and use Python to generate the differences. Return them as a dictionary, {"Running": 1234, "Paused": 4321, "Stopped": 1111} for use in your display.
You're not required to use the SQLite Tag Historian. You can create a History Provider for any Database connection in Ignition.
In case it isn't obvious, SQLite isn't an "Ignition" thing, it is just a Tool that Ignition happens to use for some things (other than the initial history provider)
Haha yeah I realize that now. I’m very new to this stuff and am trying to create an ignition demo for my plant as someone with a ME background. A lot of these basic concepts go right over my head. Thanks for explaining this.