Here is another one from the customer that wants everything to look like their old system. They are asking for numeric displays on the same screen as their Easy Charts displaying the first and last values of each pen. I am using SQLTags Historian pens on the charts. I’d appreciate any pointers as to if this is even possible. Thanks.
First and last? You mean, given the scope of what the chart is displaying?
That is correct. If the chart range is from 11:14 AM to 9:22 PM, I need to show the values of the pens at those two times.
I think this is going to have to be done with some custom scripting. You’ll probably have to separately run the same queries that the Easy Chart is running (via system.tag.queryTagHistory), and then pull the first and last values out of the resulting dataset.
The downside to this approach (besides the time it will take to create) is that you’ll be doubling your traffic - running each query twice. This sounds bad. Maybe we can add some hooks into the Easy Chart so that you can at least pull the values out of the chart…
Or you could skip all of that and convince them to use the X-Trace mode as-is.
If only it was that easy. And I quote, “The pen name on the X-trace covers up part of the trend line, can you move the name or get rid of it?”. If I need to do the separate queries, that’s fine. I’ll try it and see how it works. Thanks.
Help! I’m having trouble getting it to work properly. Can you give me an example of how I need to set up queryTagHistory?
You can call chart.getStartDate() and chart.getEndDate() to obtain the stand and end dates for the chart. You can loop through the tagPens dataset to pull together a list of tag paths. Something like this:
start = chart.getStateDate()
end = chart.getEndDate()
paths = 
for r in range(chart.tagPens.rowCount):
path = chart.tagPens.getValueAt(r, “TAG_PATH”)
results = system.tag.queryTagHistory(paths, start, end, chart.tagHistoryResolution, “MinMax”)[/code]