Enable Disable Named Query Binding

I have a named query binding, but I don't have a connection to the database at the moment. As a result, I get a binding error every second when I have the window open.

How can I disable this binding when it's not needed?

Actually, it seems like it's due to a faulted database connection.

I would like to be able to document the binding that should exist, if the database connection is valid. I would assume I would need to use a script and system.db.runNamedQuery() with a boolean to "enable" it?

How do I handle passing datetime data type variables to the named query with Python?

Not sure if I understand what you are looking for, but named query bindings have an "Enabled" option. But, if you are doing scripting and want to ensure the database connection is faulted or not, look at the System/Gateway/Database/<yourDBproviderName>/Available boolean tag

image

The named query does not have an enable/disable option. (8.1.35)

Oops, sorry, didn't see that you flagged this as Vision instead of Perspective.

Haven't had to worry too much with the case where the database connection comes and goes. I expect it to be as reliable of a connection as I would the Ignition server being up. If you are trying to query remote databases across a WAN...I don't recommend it for performance reasons.

1 Like

It's just part of a standard template I'm developing. Not all installations will have the DB connection. So it won't come and go, it'll either be there or not. I've just added a custom property bound to the database connection's "Available" tag.