[ 00:07 ]
In this lesson we'll talk about the tag history binding in the perspective module. I have a view here, I have a bunch of tags that have tag history enabled. I would like to show the records from these tags on a table in my view. We'll head over to the component palette here and under the display category I'll grab a table component and drop that on my view somewhere. Now, for this lesson here I'm not going to spend a lot of time talking about the various settings that are on the table. Instead, I'm just going to focus on the binding. We'll talk about the table in later videos.
[ 00:42 ]
To populate the table with any data, we need to place a binding on the data property here. I'll click on the binding icon and that brings up our binding interface. From the binding types on the left, we'll select the tag history binding. You can see the various settings for it here. Now, in the very least you need to specify a time range, as well as pick some tag paths. For the time range it defaults to real time, and then one hour. So, saying for the last one hour, grab the records for these tags down below. You can change this to historical which allows you to specify a start date and an end date. It uses expressions here for these fields. You can click on the little f(x) or the function button here. It gives you a little editor, allows you pick tags in your system, allows you to pick properties that are available in the view so you can put some date time pickers on the view and then have this expression reference the date that the user picked.
[ 01:42 ]
Now I'm not going to make any changes on these here. I'll just hit cancel for right now and let's head back for our time range, let's go back to real time. I think I'll just specify the last one minute's worth of data to keep it kind of brief. We then need to specify some tag paths so we'll come over here and hit the little tag button on the right and then start browsing for any tags that we want to try and query the tag history system for. I'll go to my tags folder here. I know that I have my historical tags in my sine folder here so I'll grab sine zero, hit okay and just for fun let's add one more, hit the tag button again, I'll grab sine one and hit okay. We'll use these two tags here.
[ 02:24 ]
Now you can see that there's an aggregation mode column, it's set to default so it's using the default aggregation mode for the binding which just happens to be set at min max. You can for each one of these items just click on the individual field and pick a different aggregation mode. We'll leave those with the default for right now. I'll just hit okay and there you go. You can see that we have a time stamp column and then we have an individual column for each one of my tags. Let's go back to the binding. You probably saw earlier in the binding preview our data set is showing 100 rows. That's not a coincidence, it's 100 because the query mode is currently set to point count with a value of 100. Regardless of your range here this binding will always return 100 data points. Again, the tag history system likes to aggregate and interpolate values and create its own time slices.
[ 03:19 ]
We're still looking at your time range to figure out how far back to query for. Then we take those results and give you an interpolated data set. Now if you didn't like that for some reason you can change the query mode to one of the other options. For example we can use as stored which simply returns the values that we recorded within this time range. I have two tags that are both recording values once a second, you can see down below we have 119 rows. It looks like one of my tags didn't exceed its deadband threshold for its history settings. You can see that this query mode better represents the records we actually recorded. Now if we head back up above to the return format here you do have options.
[ 04:00 ]
Right now you're looking at the wide format. Each tag path gets its own dedicated column. If you had a large number of tag paths defined in this binding, the columns here would be incredibly narrow so you could instead use a tall format which instead stacks all of the tags under one column. You can also select calculations here which allows you to apply even more calculations for each one of your tag paths. You can actually pick a whole bunch of aggregations and we'll apply all of them to whatever tag paths you specify. Now heading back to wide just to show you all of those options over here, right now this binding doesn't pole. I could enable polling and then specify a certain amount of time. I could say hey, every ten seconds re-trigger this binding and get me the most recent results.
[ 04:49 ]
The last thing I'm going to talk about here is this alias column. Now it make look a little bit different than initially, that's because I'm back to as stored. If I go back to point count you can still see that alias is there. Basically what alias does is it allows you to change the header that's being returned by the binding. Now for the table this is important because it basically changes the header. Instead of saying sine zero at the top maybe this is a pressure reading of some sort. I could type that in, hit enter and then when I hit okay here you can see that it has an updated header. That should be enough to get you started with this binding. As you can see there are a ton of options for the binding. For more information take a look in the user manual as we'll describe what each of the options do.