I have a sparkline chart which is displaying data via a SQL query for realtime charting. Problem is, if the database connection is down, the endless errors just keep being displayed no matter how many times you close the error window. I’m trying to think of a better way to handle a database connection error. In theory, to me, I like the program the HMI to work no matter if you have a connection to a database or not. In our case, the SQL databases are for Product settings (we are a steel mill) and used during changeovers only. Otherwise I should be able to restart a SQL server during production without interruption. Only this control should not display any data, but everything else should work. Unfortunately it just throws errors repetitively. Any suggestions?
Is this a SQL Query binding or are you running it in a script?
If it is in a binding, I would expect you to see an overlay on the component as opposed to an error window.
If it is in a script then you can wrap it in a try except clause
try: #script here except: pass
Not sure where my head was at, I just tried it and you get both the overlay an the error window. Makes sense.
I think this is because of the polling mode, since the binding is configured for relative polling you probably get an error at each execution.
You need a way to either, move away from a polled binding, or set the polling mode to off.
Perhaps a gateway timer event that runs a script to query the data and stores it in a memory dataset tag. Then bind your chart data to that tag.
That’s a great idea! Thank you for the suggestion. I’ll try that.