This lesson is part of the Vision Components and Property Bindings course. You can browse the rest of the lessons below.


Autoplay Off
Take topic challenge

Supplemental Videos


Learn how to create templates that point indirectly to a set of Tags based on a simple parameter.

Video recorded using: Ignition 8.1


(open in window)

[00:00] In this video, we are going to take a look at how we can make an indirect template using a simple standard type of parameter, like an integer for our indirection. Now, you'll notice I've already put together a simple template called motor and I've given it three components, a label, a simple motor graphic and an LED display which I'm going to use to display the name HOA and amped value of my motor respectively. This is based off of the motor UDT that I have created within my tag browser. You'll notice in my tag browser, I have multiple motors each of which has an amps and HOA value associated with it. You'll notice that the only difference between each of these motor UDT instances is the number at the end of the name there . Motor two, motor three, motor four and so on. Because my motors are set up in this way, I can use a simple integer parameter to represent a motor number that I can use for indirection in all of my bindings.

[01:12] The first thing that we need to do is make a new parameter and we can do that by right clicking on the background of the template and going to customizers and custom properties. Here, we can create a new template parameter. I'll go ahead and click the plus sign and give my parameter a name. I'll call it motor number and the type is already set to integer. Once I've got that set, I can go ahead and hit okay and I should see my template parameter appear in the property editor for the template. I'm going to go ahead and give my parameter a default value of one. So that way, it makes it a little bit easier to test. Now that we have our parameters, we just need to set up our bindings. I'll start with the label at the top. I want to put a binding on the text property of the label. And in this case, we'll do an expression binding where I can combine the word motor and a space with my parameter that I created earlier, motor number.

[02:18] I'll go ahead and hit okay and we can see that now my label has changed to motor one. For my motor graphic, I'll go ahead and change the color of this little square here within the graphic. I'll set up a binding on the fill paint property. And in this case, we want to do an indirect tag binding. For our indirect tag binding, we'll go ahead and start by grabbing an example of a tag we're looking for. In this case, I want this to be bound to an HOA tag and then we will make it indirect by removing the part where we want to replace it with the parameter. In this, the one in the path there is going to be replaced by our parameter motor number.

[03:06] Lastly, because this binding is not a color, we need to set up our number to color translator down at the bottom of the binding here. My values can be zero one or two. So I'll say zero is maybe a red color. One is maybe a green color and two I'll have it be a yellow. Once I have that set, I can go ahead and hit okay. And I can see that my square immediately changes to red because my HOA for motor one is zero. The last binding here is the binding on the LED display. I'll set up the binding on the value property. And again, this will be an indirect tag binding. Again, we'll start out by grabbing an example of a tag that we want to bind to. This time, we want to grab the amps tag. And again, we'll delete that number that we want to replace with our parameter, motor number.

[04:08] This time there's no number to color translations. So we'll go ahead and hit okay. And we can see our value for motor one represented in our LED display. Now that we've got all of our bindings set up, I can now use my template on one of my windows. I've already got a motor display windows set up here and I can just drag my template onto the screen a couple of times to get a couple of instances of it. Drag a couple more here. You'll notice they all start out at motor one because that's what I set the default value of the parameter to be. However, if I select any one of these instances and look in the property editor, we'll find our parameter motor number, and you'll find that I can change that to be something else, say a two. And we now seen motor two within our template. I can go to these other motors and change them as well and we can get some different motors displayed on our screen very easily using these indirect templates.

[05:14] Keep in mind that making a template indirect using a simple standard parameter type like an integer is only one method of making a template indirect and we will explore another type using a UDT in another video.

You are editing this transcript.

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