Add arbitrary events to the SQLTags log

Currently we have an application that watches for data changes and writes them to a history table in the database.

We also write a record to this table when an operator operators a control.

I am trying to replace the application with SQLTags history. (waiting for this http://www.inductiveautomation.com/forum/viewtopic.php?f=71&t=5271 to be able to display the results nicely). Is there a way to log events to the same history?

Some musings to try to answer my own question…
As all my tags are read_only externally driven, I can’t write the control to a tag.
The current method to is call a stored procedure to operate the control.
:question: Can I create a DBtag that runs SQL when it is written to?
:question: Can I setup logging to happen when a operator writes to a tag? (I would need to store login in name and time)
:question: Can I create write_only DB tags? They would not poll. They would execute the sql only when they are written to.

Well, since you’ve written your own real-time SQLTags driver, I guess the only real answer is to write your own SQLTags History driver as well :smiley:

But really, that’s what comes to mind. Here’s why: SQLTags historian doesn’t really record “events”, it records value changes, along with a scan class execution record in order to tell when the scan class was executing properly and the data was simply not changing. If you wanted to insert your own event into the history table, you’d need to also insert a record into the scan class table in order for the system to tell that the data was good. Once you’ve done that, you’ve basically written your own driver.

I guess I should go about putting together a whitepaper for that as well. In the meantime, I think you can figure it out pretty well looking at the sqlth_* tables.

(PS, the white paper won’t be along for a few weeks, I’m on vacation :stuck_out_tongue:… but I’m happy to try and answer questions here).

Regards,