Description

Learn how to use the expression bindings to return true or false based on different conditions.

Video recorded using: Ignition 8.1

Transcript

(open in window)

[00:00] In this lesson, I'll demonstrate how to display a specific graphic on a Vision window depending on a value from a tag. I have a tag named Machine State, and depending on its value, I wanna display one of these switch graphics for off, on, and manual. If the value is zero, I want to show the first one. If it's one, I'll show the second one, and if it's two, I'll show the third one. I can accomplish this by binding the visible property of these switches to a value of the machine state. The first switch, the off switch, will only be shown if the value is zero. So we'll add an expression binding. It will say the value of this tag is equal to zero. If the tag evaluates the zero, then this statement becomes true, and the value of this property will be true. If the tag is something other than zero, then the statement will be false, so the visible property will be false. The expressions on the other switches are gonna look very similar to this, so I'll go ahead and copy it.

[01:07] The second switch is the on switch, so it's expression will check if the tag value is equal to one. I'll add an expression to the manual switch so that it checks up the tag is equal to two. Now that the expressions are set up, I want it to look like this is one switch that's turning, so I can select all of these and place them right on top of each other. Now all I need to do is change the value of my tag, and the corresponding switch becomes visible, and now it appears that the switch is changing.

You are editing this transcript.

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