At a power plant I have a tag from the PLC called MWH_LAST_WEEK. At 12:00:00AM on Mondays this value changes. When it changes I want to write it to a new SQL table I will create in the ignition database called WEEKLY_MWH. The WEEKLY_MWH table will have 3 columns, YEAR (INT), WEEK (INT), and MWH, (unsigned 32 bit integer). I will create an onchange script on the MWH_LAST_WEEK tag so that when it changes it will write the year, an integer from 0-51 for the week of the year, and the new value of MWH_LAST_WEEK to the WEEKLY_MWH table.
Then I will create a chart bound to an SQL query which will extract the data from the table so that I get one series per year, with the X axis being the week in the year and the y axis being the MWH per week. I want the X axis labels to be the months in the year.
I have not done any SQL from within ignition yet. Is this the right way to do it?
thanks for any pointers