Description

Tag bindings are the simplest method of configuring a link between a Perspective Component and a Tag value. This lesson demonstrates how to create a Tag binding in Perspective.

Video recorded using: Ignition 8.0

Transcript

(open in window)

[00:00] In this lesson we'll take a look at Tag Bindings as well as bindings in general in the Perspective module. We see bindings used in many places in Ignition. A binding allows you to take the value of a property and automatically update it based on the value of something else. The most common type of binding would be a Tag Binding. So when we're in our Designer and we're looking at a View here, I can take any one of my tags and I can drag and drop it onto my View. We get an option of available components that we want to create, and then when we create these components, they'll be bound to the tag that we just dragged on. So in this case I can create an LED Display, and you can see that the value on this component is now tied to this one tag value. So as the tag changes, the value on the component changes. While I have the component selected, we can see over here that our value property has this little blue icon next to it. That means that this one property is bound to something. There's a binding to something on there. Now if I want to examine it I can simply click on the icon and it'll show me the type of binding. So we can see that it has a Tag Binding selected, it's using a direct mode, there's some other settings, we'll talk about those in later videos, but we can see that it's pointed to Tower 1/Fan Speed, which is if you look down in the Tag Browser Tower 1, and then the Fan Speed tag inside of there. So if I close this window here. Now if you were to try that manually, so say I were to go to the Component Palette, and how about I grab a Numeric Entry Field here, I'll drag this onto my View, and if we look at the Property Editor, notice that we have this little gutter here on the left hand side. And as I move my mouse cursor up and down the property list, there's a little icon that moves. Again that's the binding icon, but because none of these properties have a binding on them it's not always visible. So I could set up a binding on the value property here. We'll do it manually this time. I'll click on the binding icon for the value property, and we'll get our binding window back. Now just a quick note here, when you're looking at the Title bar it does tell you the name of the component that this binding is going to be attached to, it tells you the category of properties, so under the props category here, and then the name of the property that we're going to bind to. So now that we know we're going to place a binding on the value of this Numeric Entry Field, I need to pick a type. So if I were to manually set up a Tag Binding I can select the tag type, it's set to Direct, and then I need to specify a tag path here. Now don't type here, it's much easier to just use this little tag button here to browse a tag path. So I can click on the tag button there and then we have all of our tags available. I'll go down to my tags folder. In this case I have a little Memory Tag, that's just sort of at the root of that tag provider there so I'll select my Memory Tag. Now I can keep drilling down on my tags to get some of the sub-properties here. You'll notice that value is an available sub property on your tags. You can grab this and this will get you the value of the tag, but in most places in Ignition here if you simply grab the tag that usually gets you the value as well so either one of these would be just fine. So I'll grab my new tag here and I'll click okay. And we can see from the binding preview here that the value in the preview is matching the value on our tag. So we'll hit OK. So now we should see that if I come over to this Memory Tag here, if I try to change the value on it it should change the value on the component. Now you'll want to make sure that your Designer is in read/write mode here, so we can always go to Project, and change the Comm Mode to read/write. We'll go ahead and I'll double click on the value type something in, hit enter, and we'll see it update. Now if I try to put my Designer into preview mode here if I try to change the value here, on the control or on the component, so if I were to put a one in there and hit enter, we'll see the value on the component changes. However, the value on the tag doesn't change. The reason for this is because Tag Bindings, really all bindings by default, are unidirectional, which means the flow of data really only goes in one way. So in this case when we have a property and it's bound to something else the flow of data always goes from that something else, in this case a tag, to the component. It doesn't flow in the other direction. If I make a change on the component it's not going to go back to the tag unless I make the binding bi-directional. So if I were to, I'm going to take my Designer back into design mode here, and with my Numeric Entry Field selected I'll go back to the binding here and we can see all of our settings are still there. There's this little Bidirectional check box. Now, not all of the binding types have the Bidirectional check box. But for the ones that do you can simply enable it and then this will allow you to synchronize the value on the property with whatever you're binding to so in this case the tag. So if I hit OK here, again I can go back into preview mode, or I can launch a session if I wanted to as well. We can go ahead and try that again. I'll put a little 2 here, we'll hit enter, you see that the value on the component changes and that got pushed back to the tag. Now for the last little part here again I'm going to take my Designer back into design mode here. I'm going to select my LED Display, now say I wanted to remove a binding. I didn't want this component to automatically update based on the tag anymore. So I could go ahead and examine the binding on the property here. So I can click the binding icon again. And in the lower left hand corner there's a Remove Binding button. I did that a little fast here, so if I go back to the Tag Binding here there's a Remove Binding button. I can simply click on that, hit OK, you'll notice that my component is no longer automatically updating. The tag's still changing value, the component's showing the last known value that the binding provided to it but they're no longer synchronized. So hopefully that gives you a good idea of how the binding system in Perspective works as well as how Tag Bindings work. I did show you the whole process of manually setting up the bindings but in all honesty it's much easier to simply start dragging and dropping your components onto the View.

You are editing this transcript.

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