You can help by commenting or suggesting your edit directly into the transcript. We'll review any changes before posting them. All comments are completely anonymous. For any comments that need a reply, consider emailing firstname.lastname@example.org.
We are experiencing playback issues from our video hosting provider. Please check back shortly.
2:58Basic SQL Query
2:43Tag Historian Query
1:32Tag Calculation Query
2:03Alarm Journal Query
Take topic challenge
Tag Historian Query
Easily access tag history for use in your reports with the Tag Historian Query data source
Video recorded using: Ignition 7.9
Transcript(open in window)
[00:00] The tag historian query data source works in a similar manner to a tag history binding you'd find on a vision component. Let's begin by creating a tag historian query data source. In the data panel, we'll click on the plus icon and tag historian query. From here we can drill down to each of our historical tags. I only have two so far, tag one and tag two, and they're sitting out values of 12 and 24 respectively. To add our tags we'll Shift + Click and then drag and drop to the selected historical tags. There are two columns here, first is the tag path, which is the path leading to the tag. The second is the data key alias. This is the name that the tag will use in the design panel, so you can give all your tags a unique name here. Let's take a look at how this looks in the design. We'll go to the key browser. We drill down on our data sources. You'll see we have tag one and tag two. Go back to the data panel. Now, on the right hand side you can change the data key name, you can change the query type, you can specify a preview limit, and you can also create a nested query. And if you look down below, you'll see a lot of the same properties that are available on a tag history binding. You can set the date range. If you set this to historical then you need to configure bindings for the start date and the end date. When you create the tag historian data source, these properties are bound to the start date and end date parameters automatically. Now, we won't cover all of the properties in this video, but I just wanted to point out that the advanced properties are there. We'll go ahead and set the aggregation mode last value and then sample size at natural. Now, it's important to note that you can type in here and use parameter references. So we'll go ahead and do that. So we'll begin by clicking on the plus icon. Do a new parameter. We'll call it TagNum. We'll leave the parameter type as a string and a default value of one. Now that we have a parameter created, we'll go back to our data source. Now, we don't need the second tag here, we can go ahead and delete that since we're using the indirection. We'll update our alias, to just tag, and we'll use our parameter in our tag path, so. We'll get rid of that one, the TagNum in here. Close with a brace. And that's really all we need. If we take a look in the design panel, you'll see I have a table set up here already. Let's see, tags shows up as a key in our tag history query data source. I also placed some text inside of each text shape just so we know what each value is supposed to represent. Let's see what this looks like in our report viewer component. You can see it defaults to the tag name one so it's showing a value of 12. It's showing the timestamp as well. But if we scroll down here and we just change the tag number to two, you see the report executes again and shows the history for tag two.