I have a value I want to historize, however, I want to be able to insert the value into a previously created table on my db, instead of having it create a new table. If this is not possible, is there a way to change the name of the table the tag history will create from 'sqlt_xxx' to a custom name without breaking the connection?
No.
The database tag historian uses an off the shelf database, but its inner workings should be considered opaque - you get to use your existing database, but you do not get control over the tables or their structure.
If you want control over storage of data, you must use transaction groups or scripting.
Thanks for your answer. A little off-topic, but if I were to use scripting I would go for a Value Changed script, is it possible to incorporate a timed component to that script as well? For example, if the value hasn't changed in X amount of time, insert anyways.
Put your operation into a project library script function. Call that function unconditionally from the tag change event. Call that function conditionally, based last timestamp, from a gateway timer event.
(Do not perform database operations from a tag's own valueChange event unless you "fire-and-forget" with the store-and-forward system.)
Could a view help accomplish the goals of having a custom named table? (If you have pre-existing software that expects to read tag history from something named like 'history_xxx')
I don't know if the gateway timer event would work for me because I have several tags that will need to insert tinto the database on change and periodically as well.
You might be able to accomplish this with a transaction group as you can define the table name there.
You need a gateway timer event to have any chance of recording periodically. Tag change events simply will not do that part for you.
and is there a way to have the gateway timer event execute the script on several tags?
Sure. The timer event isn't naturally attached to any tag at all. It will simply handle the tags you code it to handle. (Use system.tag.readBlocking()
with a list of tag paths to get a list of all QualifiedValues back.)