Any help or insight on how this might have been done?

And your dataset matches the dataset of the existing one with columns in the exact same order and format?

It's been a while since I actually did anything in perspective, but this is what I came up with.

Took me a while to remember that you can bind a time series dataset directly to a series in a chart component. So, I came up with 2 scripts like I mentioned before, one for met and one for not met.

On the root container:
image

Series 0 and 1 bindings are to the data property with this script transform (comment the newData.append line appropriately).

def transform(self, value, quality, timestamp):
	dataset = value
	setpoint = self.parent.custom.setpoint
	
	headers = ['time','met']
	newData = []
	for i in range(dataset.getRowCount()):
		time = system.date.toMillis(dataset.getValueAt(i,'Time'))
		rate = dataset.getValueAt(i,'Value')/100
		newData.append([time, ( rate >= setpoint ) * 100])
		#newData.append([time, ( rate < setpoint ) * 100])
		
	
	return system.dataset.toDataSet(headers, newData)

Now it's just a matter of formatting the chart so it looks the way you want. Or maybe your series properties are on a different component. You never did answer that question.

But no transform on the custom itself? just a tag history binding to the tag or an indirect binding to that tag?

I made dataset tag that replicated the form of the one shown in your screenshot.

No tag history binding, just a binding to this dataset

The series components are on the same component chart, but when I run that script on them it seems to have an issue with that line 8 "system.date.toMillis" and won't work.

No it very likely does not. This is the current transform script.


And this is the tags it currently goes to as well as how it is currently configured ahead of the transform script.

If I swap those existing tags with my tag, it has an error message. I can delete things to clear the error, but then it does nothing.

Nearing my wits end here. This line of work is clearly not for me.

Or is there any way that script transform could work on a tag that doesn't already have a dataset? Like if its just a normal history tag?

Start with the tag history binding and see how the data comes in. I don't have a tag with tag history configured, so I can't test that on my own. Show me the data that results from the binding.

Do the tag history binding on a root container custom prop

Your history binding is going to bring in a dataset, but then those (probably) analog values are using the transform script to convert that to essentially 3 columns at a minimum for the trend to work. The 4th column they're using is probably just for information only when looking at the dataset for troubleshooting.

  • t_stamp
  • Above Min (value is good = 1, value is bad = 0)
  • Below Min (value is bad = 1, value is good = 0)

You'll need to parse your data in a similar fashion to generate in the transform this output dataset to get the desired results.

Pardon the stupid question but what do you mean when you say parse the data what exactly are you meaning? Man I hate how dumb this is all making me feel (or how dumb it is revealing me to be)

So in your original transform script, they're taking the tag history for those values and "transforming" it by parsing through the data and creating a completely new dataset without any original values except the t_stamp.

1 Like

shoot is there any way I could just message you directly I think I am getting turned around here trying to go two different ways at once

Okay, throwing a lot at you here but this is what I've got currently.

I have the dataset as a custom value of the root for the page, and it is bound to the tag I want to use. It looks like this:
image

And for what it's worth, that seems to be fine? But it might not be, I read fine as having no error messages.

Now this is what it looks like if I try to do the bindings as you wrote to do them for the series "data" on the Time Series chart itself


It renders it as an error script eval, citing the problem as having to do with the system to milli line, however deleting that line merely leads the error to say it is an error on the following lines.

So that is where I am at.

if you littlery duplicate the view does it still work?

If so duplicate it and disable every binding, dont delete just disable. This way the current values are stored. So we can take a look at them
Share the whole view with us

Shoot, unfortunately the plant is down for the 4th, so there are no values with which to show. When there is data coming through though, I will do that.

Okay this is where I am at to try and lay it out.
This is all in perspective.

I have this tag:


It tracks the current amount of pounds per minute a laser line is moving.

I also have these setpoint calculating custom values:
image
The setpoint changes dynamically, so these custom values track and hold that info.

I want to make a time series area chart that will show a 'status' across the shifts entire 12 hour period, where the chart will fill in intervals with either green to show the value of the tag was over the setpoint or red to show it was below the setpoint.

My hangups are that I continue to fail to get datasets to work correctly so if there is a canned way to do this or a way with simple script transforms that would be preferred. Everybody's help and time so far/ already has been very appreciated, thank you.

Please provide the exact error message. Your indentation is off by one level. Highlight all the code after transform and hit shift+tab.

Hit the magnifying glass on your bound dataset so I can see the exact column names. Line 8 is reading the date from the dataset using the column name, so that name must match exactly. Line 9 does the same thing for the value.

Exact error Message is as follows:
image

This is the custom dataset exactly, apologies it currently has no info in it:
image

Ok, so just use column index instead of column name.

def transform(self, value, quality, timestamp):
	dataset = value
	setpoint = self.parent.custom.setpoint
	
	headers = ['time','met']
	newData = []
	for i in range(dataset.getRowCount()):
		time = system.date.toMillis(dataset.getValueAt(i,0))
		rate = dataset.getValueAt(i,1)/100
		newData.append([time, ( rate >= setpoint ) * 100])
		#newData.append([time, ( rate < setpoint ) * 100])
		
	
	return system.dataset.toDataSet(headers, newData)
2 Likes