This lesson is part of the Building in Perspective course. You can browse the rest of the lessons below.

LESSON LIST

Autoplay Off

LESSON

Adding a Transform

Description

In this lesson we'll look at Transforms; A Perspective feature that you add onto a binding to further manipulate the resulting value.

Inductive University Lesson: Map Transform

Transcript

(open in window)

[00:00] Welcome back, so last time we added some bindings to our overview vessel and I did want to talk a little bit about or at least introduce the idea of what a transform is. And we're actually going to talk about those by handling the little percentage here for the vessel. So I didn't say last time that the vessel is doing a little bit of rounding, right? So we are losing some decimal places that are actually being reported on our tank capacity tag here. So I did want to kind of a shoe horn in this example, just to kind of show you what a transform is. So if we look at the value property that we configured our binding on last time, you do notice that the property is aware of additional decimal positions but the components on the rendering, or it is just rounding up when it shows the value here. Now, part of that is because a display value as a percentage is true. So it's just trying to just give us a percentage out of 100 and then doing the rounding of course.

[00:58] Now we could turn that off and it does give us basically whatever raw video or raw value is sitting on the value property there, but we can actually round that off ourselves if we wanted to. So what I'm going to do for the value property here, I'm going to click the little edit binding button here, and we can see in the binding preview, right? We are still getting that raw value. So here's where we can do some rounding. We can add what's called a transform. So I said this already a couple of times but a transform is effectively an extra step you add to a binding that lets you further manipulate the value that the binding is bringing in. So, for example we have an indirect tag binding configured here and that's going to a tank capacity and it's getting a value and it's reporting that value here. So we can actually add an extra step that looks at the value that the binding brought in and then does something with it. And that something's pretty wide open. So, the way you add a transform is you just press the add transform button here. And we do have a couple of different types. I'm not going to go over these here. We do have some additional Inductive University videos.

[01:57] You could check out if you wanted to learn more as well as the user manual of course. But they're useful in a lot of cases where again you're trying to do more value replacement. So the map transform is a good example because say you get a tag value or some value that's a numerical value, but then you want to translate that to a string. So, the map transform basically provides you a little interface. You can use to build that instead of writing like a script or something. So in this case, we do have a format transform, which will allow us to just apply some very simplistic formatting here. So I'll select the format transform and then click add transform. Now, when we're looking at this here, it does give us some options. It's already trying to do or format the value coming in as a number, which is fine. And it does actually do some rounding for us, but say we maybe, we wanted to round off to only two decimal places. So I could change the format here. I could change it to pattern, and then we can actually type in the pattern we want to see here. So we can use the zeros for a significant digits.

[02:55] So I could say zero, zero, cause I always want at least the tens and the ones digit, I'll put a period down and then we'll add two more zeros for two decimal places. And there we go, you can kind of see that in the preview down below. So we'll click okay here and there we are. So again, the point of the transform is it gives you an extra step that you can do some additional work or manipulation to the value that the binding is bringing in. All right, that about wraps up this video I'll see you in the next one.

You are editing this transcript.

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

close

Share this video