Historical data into sql database

How can I dump historical time series data of selected tags for a given time range from a table displayed into a database table of given name?

You write a script to do row by row inserts. (There's no magic wand for this in Ignition.)

Would have been a nice feature to have, which perhaps would have been easy for IA to implement! Just like transaction groups but on historical data rather than real time OPC tag values.

Alternatively, is there a way to search the historian database for a set of tags, using sql queries to get a list of tag values in a given time range and write them in another table?

1 Like

Wow this is what I was looking for! I will read it further and see how to uses these functions to achieve my results. Hope values will be interpolated wherever not available. I don't know what's the granularity of t_stamp, is it only stored time stamp or at regular interval. Thanks a lot!

Read the documentation it clarifies all my doubts! Great! well thought out and well documented function! However, building the list of tags will have to be hard coded. Building drag and drop like in charts or table would be missing (or built!). Great feature useful for a lot of use cases!

It depends on the settings in the tag history definition. I suggest that you experiment with this and gain some understanding of how historian stores and compresses data. It's kind of tricky and some of its limitations include not doing any interpolation to get the estimated value at the bounds of the period of interest.

If, for example, you want values of a process variable or counter on the hour (or minute or ten minutes, etc.) then historian will disappoint. In this case I recommend creating gateway scheduled events. Project Browser | Scripting | Gateway Events | Scripting. See Gateway Event Scripts | Ignition User Manual.

As an aid to seeing how historian is working I suggest that you create a Perspective view with a couple of datetime selectors and a table. Add a Tag History binding on the table's PROPS.data. Set Query Mode to "AsStored". Set the Time Range to "Historical" and bind the Start Date and End Date to the datetime selectors.

Yes, thanks for your valuable tips, very useful. I don't want to generate this based on event triggers like time bound etc, I want to generate it on demand when users clicks a button etc. But may be event triggered reports will also be required sometimes. Thanks a lot indeed. IA has put in a lot of thought is building the scripting functions!