You can help by commenting or suggesting your edit directly into the transcript. We'll review any changes before posting them. All comments are completely anonymous. For any comments that need a reply, consider emailing training@inductiveautomation.com.
Version:
LESSON LIST
-
6:41Tag Binding
-
4:55Indirect Tag Binding
-
3:16Property Binding
-
3:27Expression Binding
-
4:55Query Binding
-
5:35Tag History Binding
-
2:43Component Overlays
Take Topic Challenge
Supplemental Videos
-
3:31HTTP Binding
-
2:55Expression Structure Binding
-
3:14Tag Binding - Expression
-
3:01Tag History Binding - Expression
-
2:55Tag Drop
LESSON
Expression Binding
Description
Expression bindings provide Perspective component full access to Ignition's Expression language.
Video recorded using: Ignition 8.0
Transcript
(open in window)[00:00] In this lesson, we'll take a look at the Expression Binding type in Perspective. If you've seen the Expression language before, then you already know how it works, but it's important to know you can use Expression Bindings with Perspective components. So here I have a couple of Ramp tags here and a couple of LED Displays. I would like to add the value of two tags here, we'll go with Ramp0 and Ramp9, I suppose. And then whatever the sum of those two tags are, I want to show on this one LED Display. So we'll do a little bit of math. So I'll select this LED Display for the value property here. We'll click on the binding icon, and I'll select an Expression type. So now we can write our Expression. We'll grab a couple of tag references and then just add them together. If you look on the right-hand side here, there's a bunch of options. You can also resize the panel if you'd like. I'll click on the tag button here and browse. I'll start looking in my Tags folder. We'll go down into our Ramps folder, and I'll grab Ramp0 and hit OK. So we see we have a tag reference that's wrapped up in the curly brackets there. So we have one tag, but let's add a little bit more here. So I'll make sure my text cursor is at the end of that little tag reference there, and you can see that there is a little plus equal sign here. This shows you all of the available operators. So I'll go down to Mathematical, we'll pick Addition, and then I'll grab another tag. So in this case, I'll go back to the tag button, and we'll grab that Ramp9 and hit OK. And you can see in the preview down below, it's already adding the two together. So I'll hit OK, and there we are. Now let's expand upon this a bit more. We do have functions in the Expression language. So how about we take this LED Display and we show the value of this Memory Tag down here, which has a negative number, let's show the absolute value on the LED. Again, we'll find the value property. I'll click the binding icon. We'll do an Expression Binding again. We'll head over and we'll take a look at this fbutton, or this functions button, and it gives you a list of all the functions in the Expression language. We'll head over to math because we have the absolute, or abs function, and we simply need to provide it a number. So, in this case, the number would be the value on our Memory Tag. So I'll click on the function, and you'll see the function is written for us. So now we'll go ahead and place a reference to our Memory Tag. I'll click on the tag button again. We'll go to our Tags folder. We'll grab our Memory Tag and hit OK. And we just need to close that function off there. So I'll put a closing parenthesis at the end, and you can see that it's giving us the absolute value in the preview. We'll hit OK, and there we are. Now there's quite a bit more you can do with the Expression Bindings here. If I head back to the binding window, you can do stuff that doesn't even have anything to do with a tag. So if you wanted to return a date, concatenate some strings, whatever, there's a bunch of options here. But the main takeaway is that you can apply these Expressions to properties in Perspective.