Version:

LESSON

Tag History Binding - Expression

Description

Learn how to configure a Tag History binding based on a custom-created property.

Video recorded using: Ignition 8.0

Transcript

(open in window)

[00:00] When working with Tag History Bindings, it is sometimes useful to dynamically bind a tag path for your Tag History query. In Perspective, we can accomplish this using an expression inside our Tag History Binding. So, to demonstrate, I've configured a Main View here and on this Main View, I've configured an Embedded View component. This Embedded View component is using My History View and My History View takes a parameter called tagNum. Now, switching over to My History View here. And, as we can see, it contains a Table component. My goal for this table is that it will show historical data from either MyTag1 or MyTag2, depending on the parameter passed to the View. To configure this, we'll, of course, need a Tag History Binding. I've already configured the beginnings of a Tag History Binding here. For my table, I'm using a Return Format of Wide. I'm using a Query Mode of Periodic with a Period of 30 seconds, and a Time Range of 10 minutes. All that's left is to configure the tags I'd like to use and, in order to dynamically specify tags, I'll need to use Expression here. All that I plan on putting in my expression is a simple property reference. But, for that, I'll need a property. So, for now, I'll just come down here and click Cancel. And, on my table I've already started configuring the Property I'd like to use. The Tag History Binding is expecting an array of objects, and, for that, I configured a History Tags array and I've inserted an object into my array. Every object in this array corresponds to a tag that I'd like to retrieve historical data for. For the Tag History Binding to work, I need to provide three keys in each object. For starters, I need to specify a path to my tag. I can also specify an alias, which will give the tag a custom name in the returned data. And I can specify an aggregation mode to use for the tag history data. Since I already have the property configured, we can go up and take a look at how it'll work. So, I'll go back into my Tag History Binding. I'll specify Expression. And I'll find my property in the property browser. Now I just need to press OK to see how it works. And we can see that our query has been successful. Now, in order to make our tag path dynamic, we'll need to configure a binding on the path property. So, I'll select the binding icon for our path property. And I'll configure an Expression binding. I already have the expression I'd like to use. It's simply a tag path, where we pass in our View's tagNum parameter. So, I'll click OK. And then, just to see this in action, I'll clear out our alias so the tag name is shown above. And then I'll return to my Main View, select my Embedded View component, and then when I change the tagNum parameter, we can see that the tag changes from 1 to 2.

You are editing this transcript.

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