system.tag.queryTagHistory - why does it fill in timestamps when trending two tags with different update intervals?

I’m trending two tags side by side. The history is stored on tag change, and the polling engine scans one of them every 4 hours, and the other every 15 minutes. The dataset that is generated by this function always has the first column for timestamp, and the other two columns for the tag values.

So, the function always generates a dataset that has a timestamp that is every fifteen minutes, and fills in the corrosponding correct value for the first tag that gets updated every fifteen minutes, and fills in whatever the last good read was for the second tag:

image

Looking at the chart above, we see that the second tag has a lot of data filled in for the timestamps. This isn’t real data. Is there any way to make that dataset have an empty cell for the values for the second tag if there isn’t a real time-stamp?

Here’s the query I’m running:

	tagList = [
	'[default]Compressor Stations/WestWater Compressor Station/WEST WATER COMPRESSOR STATION/SUCTION STATIC PRESSURE',
	'[default]Orifice Meters/Duck/DUCK CREEK 13-28/GAS FLOW RATE']
	dataSet = system.tag.queryTagHistory(paths = tagList, startDate = startDate, endDate = endDate, returnSize = -1, returnFormat = "Wide")

I’ll update what I found when I spoke to Brian with Inductive tech support, and try to echo the conversation here.

Ignition does not have an argument/parameter that you can call within the queryTagHistory which stops it from “filling-in” values for tags that have different timestamps associated with their tag values. I understand that when we have a t_stamp column, it needs to be shared with two tags. I was hoping that there was some sort of way to have the dataset leave rows blank if that timestamp isn’t associated with that specific value, rather then just filling the tags value based on whatever it was during the last poll cycle.

It gets pretty problematic when you have a scatter plot of two tag histories next to each other. The orange tag only changes three times, but the scatter plot fills in making it look like there is a tag change and the device was polled. That’s because the green tag gets polled every fifteen minutes:

One last little rant, I find it interesting that sometimes when calling a taghistory query, ignition does leave some rows blank, when two or more tags are plotted next to eachother, but this only occurs for the values at the beginning of the dataset when one tag’s value hasn’t changed but the other has:

image

Your desire for blank rows in this case isn’t going to happen because that would break charting, where blank rows break the line on a chart. Along with anything else where NULL means bad quality.

The issue is that you are trying to force the Tag Historian to do something it isn’t made for–synchronized sampling at intervals. That is what transaction groups (SQL Bridge Module) are for, and what you should be using.

I looked into the SQL bridge, and I am of the understanding that although you can get one single timestamp for multiple tags, that timestamp isn’t indicative of the timestamp from the tag provider? That could be misleading.

You say blanks can break the lines, but what happens with a scatterplot?

The row timestamp can’t be, if you think about it. However, you can record each tag’s value timestamp as separate column.

Uhm, what kind of scatter plot uses time series? And if you drop the t_stamp column, what kind of scatter plot could use a null in x or y?

Uhm, what kind of scatter plot uses time series? And if you drop the t_stamp column, what kind of scatter plot could use a null in x or y?

To generate the graph you see in second first post, I used perspective’s time series chart. The plots.trend property has two different trends overlayed on eachother, one type scatter, one type line:

[
  {
    "visible": true,
    "type": "line",
    "series": "Boiler",
    "interpolation": "curveLinear",
    "breakLine": true,
    "stack": true,
    "radius": 2,
    "axis": "test2",
    "columns": [],
    "baselines": []
  },
  {
    "visible": true,
    "type": "scatter",
    "series": "Boiler",
    "interpolation": "curveLinear",
    "breakLine": true,
    "stack": true,
    "radius": 2.3,
    "axis": "test2",
    "columns": [],
    "baselines": []
  }
]

As far as what kind of scatter plot can use a NULL x or y, I’m not an expert by any sense of the word. But, If I were to draw a graph by hand that had empty cells for certain timestamps, I would just skip that timestamp over. I know it’s not that easy for you guys.

Interesting. So we can have a separate timestamp column for each tag. Perhaps the SQL bridge might work. I’m trying to imagine what a time series chart will try to do if we have different timestamp columns for different tags. How will it choose to render the y axis? I imagine it still must default to the timestamp generated by the SQL bridge.