Learn how to setup a Named Query binding. The Named Query binding takes an existing Named Query and uses it in a binding.

Video recorded using: Ignition 8.1


(open in window)

[00:00] In this lesson, we'll show how to set up and use a named query binding in ignition which allows you to use one of your pre-configured queries and pass parameters into it using values from either tags or other components on the window. Let's see how to set up a named query binding to some existing named query. Starting from an empty window will add a simple table component for our data and then expand it a bit. And then scrolling up. We'll add a numeric text field beneath it for our parameter value next. We'll set up the needed bindings. We'll select the table then find its data property and click on The Binding icon in the property binding dialogue in the SQL section. We'll set up a new named query binding. Setting up a new named query is the subject of another lesson. Assuming our name query already exists, setting up the desired binding is really simple. We start by selecting the path to the named query. I only have one here, so I'll select it.

[01:06] This displays our selected query as read-only along with any needed parameters. Our query selects all records from the storage table where the "baynum" parameter equals a specified value. So next we need a value or an expression for that parameter. You'll notice on the right, we have both a property binding icon and a tag binding icon to bind either some component property on a window or a tag value. Since we'll be taking the value from the other component we added, I'll go ahead and select the value parameter and open the property binding window. Then we'll navigate to the numeric text field and then, to its integer value property, and we'll use that as our parameter. You'll notice that the full path to that parameter is added here if we expand this a bit. Finally. I'm going to leave the polling mode off since any time I change the parameter it'll automatically re-query the database with a new parameter value. So I'm just going to select the OK button to save my changes. Right now my query is returning no rows into the table. Though it has auto-populated the column names. This is because the "where" clause can't find any records corresponding to a parameter value of zero. However, if I put the designer into preview mode and enter say 2 into the numeric text field, now the query returns all rows with a bay number of 2. And if I enter a a 1 or a 3 like so, changing the parameter value automatically updates the query results. So that's about all there is to setting up a simple named query binding with a parameter.

You are editing this transcript.

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


Share this video