Version:

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

Supplemental Videos

LESSON

Drop Configuration

Description

In this lesson, learn more about the Tag Drop properties available on Perspective Views.

Video recorded using: Ignition 8.1

Transcript

(open in window)

[00:00] Within Perspective, we have the ability to drag and drop a tag onto a view to create components that are automatically hooked into the drop to tag. So for example, if I find my integer tag here, I can drag into my little test view here, like, so and then I can choose a component, let's say a cylindrical tank, and then we'll get a cylindrical tank component that's already bound through to my integer tag. Now this is a great little shortcut for adding components into Perspective, but there's a little bit more to it. In addition to creating components via this drag and drop method, we can also create view instances. In this lesson, we'll explore a few different ways we can drag and drop tags to create embedded view instances rather than just components. So the first step to configuring this is to find the embedded view I'd like to use as a target. I already have one in mind. I'm just going to find the fill level view in my project browser here and open it up. Now, the way this view works, is it takes a fill level as a parameter, and it just fills out a label and cylindrical tank component with that fill level.

[01:07] Now everything inside the view is hooked up already. So if I set the parameter value here to say 50, the components update to match. What I need to do from here is provide a way of linking that fill level parameter to a tag that's being dropped. For that, I'm going to find this drop config section in the view properties, inside of there, we'll find two options UDTs and data types. And for now I just want to link to an integer tag. So I'll expand data types and click add array elements. Once that element is added, we'll find an object with three nested properties. The first is type, which refers to the tag data type. We can use any tag data type we want, in this configuration, we'll be able to add instances of this view whatever an integer tag is dropped in which is just how I want it. The next field on here is a parameter. So when my editor tag is dragged in, what view parameters should receive the value from that tag. Here, I just need to specify my fill parameter. So I'll type in fill, and then the final field on here is interesting. We're given an action choice and our choices are bind and path.

[02:08] This actually dictates what gets passed into my fill parameter. We can either configure a tag binding on the tag drop which would pull the value from the tag onto my fill parameter, that's the binding choice here, or we can just pull any path to the drops tag which would allow us to do something fancier like an indirect tag binding to a specific tag property. I'm happy leaving this as is on that bind option. So with that done, we can find our way back into my test view here and then we can test out our drop configuration. So I'll take my integer tag again, drag that in and this time at the bottom of the list here we'll get an option to create our fill level view. And when I select that, we'll get our view. If I select the embedded view here, we'll see our field parameter listed but they chain link icon next to it which is that tag binding that was auto-generated because we selected the bind option for the drop action. Now that we've seen a way to link views through from standard tags. Let's also look at a way to link to user-defined types. In my tag browser, I have this tank's folder which contains many instances of a tank data type I created.

[03:10] And in my project browser, I have a tank template I created to show values for this UDT specifically. So I'll go ahead and open that up. One brief note here, we did work with this view in a previous video and we've already done an example of a drop configuration to a UDT using a tag binding as the action. So to see that specifically, check out the UDTs and template views video. Here, I've configured my view to accept a tag path to a UDT instance. So currently it's working with a default value of default tanks tank one. We just have indirect tagged bindings inside the view tying all of the fields to different member tags in the UDT. So if I click on my cylindrical tank for example and go into the value binding, we can see that it's just the tag path parameter followed by a specific tag name to reference. Closing out of that, I'll find my way back onto the view itself in the project browser. And now we can configure a way to create instances of this view whenever my tank UDT is dropped. So if I drop config here again, expand UDTs this time, add an array element.

[04:12] And the only difference here is that the type we specify is a user-defined type rather than the standard type, the other fields are the same. So for the type I'll expand the dropdown then expand the tags data types and then select the tank data type. Then for params, I'll type in tank path which is just the name of my parameter here. And then for the action, I'll select path. So this time we'll be pulling through the tag path to the UDT instance onto that parameter. And that's it. So now if I find my way back into the test view I can find a tank in the tanks folder or the tag browser drag that in and then select the tank template view, and then we're good. So that wraps up our discussion with drop configurations for views. They are a great development shortcut when you're working with views you want to link to tags.

You are editing this transcript.

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