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


Autoplay Off
Take topic challenge


Expression Transform


This lesson examines the Expression Transform, which takes the results of a binding, and exposes it to an expression.

Video recorded using: Ignition 8.0


(open in window)

[00:00] In this lesson, we'll take a look at the Expression Transform. In my View here, I have a Label and the text property of my Label is currently bound to this little temperature Memory Tag. I would like to add some static text into this Label in addition to the tag's value. Let's take a look at the binding here on the text property. And we can see we're just doing a direct tag binding right now. I'm going to add a transform. We'll select an expression type, and I'll click Add Transform. Also make this a little bit bigger and zoom in with control and the mouse wheel here. So when you're using the Expression Transform, there's this built in reference value. This represents whatever value that's being passed in from either the binding or any prior transforms. If you need to use the reference in multiple locations in your expression, you can simply type it again. Right now I'm simply doubling the value, just to kind of show you I can add it again. Now I don't want to double here, instead I want to add some static text. So why don't I head over to the left hand side here, and lets add some static text. How about we just say current temperature and then state the value. Now I do appear to have a little spacing problem, we'll add a trailing space here, so it looks a little bit nicer. And maybe we can close this off with a unit of some sort, so maybe this is the temperature in celsius. We'll hit okay here and when we check our Label you can see that it now has the static text, as well as the tags value. And of course because it's a binding. If I change the value that's on the tag, it's now incredibly hot, but the text is still there. Now let's head back to the binding and what I'm showing you here, is admittedly a bit contrived. We could have just as easily used an Expression Binding to accomplish the same thing. So the reason you would want to use the Expression Transform, there's actually a couple. So for one, I've separated the actual expression I'm writing here, from the value that's coming in. These are two separate entities that can change independently of each other. So I could change the tag path later on from here. I could make this an indirect binding instead. But my expression is still going to work the same. I'll switch back to a direct Tag Binding for a moment. Lastly the other reason you'd want to consider an Expression Transform is that remember you can chain transforms together, so if I were to add another transform, say we'll do a Format Transform this time. I'll add that in here. We can always just use an Expression Transform after any others. So if I were to swap position of these two here, you can see that we're still kind of chained together and I'm ultimately ending with my Expression Transform. So if I were to change the format on this, say this is a currency all of a sudden. Our first transform is working, applying whatever work it needs to, to the value, and then hands that off to the expression. So we can always just end our bindings with an Expression Transform, to do any sort of clean up or additional data manipulation.

You are editing this transcript.

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


Share this video