Description

Learn how the different polling modes (polling off, relative, and absolute) work for the SQL Query binding.

Video recorded using: Ignition 8.1

Transcript

(open in window)

[00:00] In this lesson, we'll take a look at polling modes for SQL query binding. A polling mode dictates how often the underlying SQL query is going to execute. Let's consider this very simple example demonstrating polling. We have a label and we'll bind its Text property to an SQL query. We'll replace this template query with a very simple one to select the current time. So, select current_timestamp like so. We'll also specify the database connection to use rather than relying on the project default. So in our case we'll select db_iu. Polling modes exist for all database binding types. So for named query and DB browse binding types also as well as for SQL query. There are three polling mode types; off, relative, and absolute. Off means the query will run only once when the window is opened.

[01:07] Relative means the query will pull at a project's base rate, which is five seconds by default. But you can also adjust that polling rate by adding or subtracting some fixed number of seconds to that base rate. An absolute means you can specify any polling rate be it 5, 10, 30, seconds, whatever you wish. Let's first look at polling mode off, which is going to run one time only if we select off and click OK we see the current date and time returned. It's now six minutes and seven seconds, but it is not updating. It only runs once if we close this window in the Designer. And then reopen it from the Project Browser. We see that it's now six minutes and 33 seconds it ran again when the window was reopened, but it is not updating beyond that next. Let's look at relative polling mode. Which will update? At the Project's base rate which is five seconds by default if we select the relative mode and click OK.

[02:13] We now see the date update every five seconds. It just turned to 10 seconds and in a moment. It's going to be 15 seconds. And so on we can see that it's pulling every five seconds as expected. Where would we change that base rate if we wanted to? We can go up to the Designer menu to Project. Project Properties Vision Timing and change the polling base rate, which is in milliseconds. So here 5,000 is the default five-second base rate. So the nice thing about the relative polling mode is that you can change that rate in one place for all queries using the relative polling rate. The last option will take a look at is the absolute polling mode where we can specify the rate to be anything we want.

[03:09] So if we select absolute then specify a rate of one second. Then click OK we can see that the query returns an updated label value every one second. One important polling consideration to note if we have lots of such polling queries. Let's say we have a hundred clients open that have the same window open at the same time and they're pulling it. Let's say every one second. We're going to have a hundred queries hitting our database every second. So be really cautious about all the polling queries we put in there. Although there are times when we do want that screen to update automatically from values in the database. All right that wraps up our demonstration of the three database polling modes off relative and absolute.

You are editing this transcript.

Make any corrections to improve this transcript. We'll review any changes before posting them.