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

**URL:** <https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [June 19, 2024, 4:48pm UTC](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108 "2024-06-19T16:48:22Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [July 3, 2024, 7:01pm UTC](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108/42 "2024-07-03T19:01:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [July 3, 2024, 7:27pm UTC](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108/43 "2024-07-03T19:27:39Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/f/ff9dbb2968bf9ff0450444a6e0fead8c70dafca0.png)

On the root container:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/1/f1ab9c42df7c37084fe002be77eba4cb151490bf.png)

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

```python
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.

---

<div class="post-metadata">

**Author:** ![D\_Mitri\_Tompkins](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@D\_Mitri\_Tompkins](https://forum.inductiveautomation.com/u/D_Mitri_Tompkins)\
**Post date:** [July 3, 2024, 8:12pm UTC](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108/44 "2024-07-03T20:12:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [July 3, 2024, 8:15pm UTC](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108/45 "2024-07-03T20:15:49Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/b/db21ddff6abccab100832ce81fc487864dbc8d6c.png)

No tag history binding, just a binding to this dataset

---

<div class="post-metadata">

**Author:** ![D\_Mitri\_Tompkins](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@D\_Mitri\_Tompkins](https://forum.inductiveautomation.com/u/D_Mitri_Tompkins)\
**Post date:** [July 3, 2024, 8:16pm UTC](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108/46 "2024-07-03T20:16:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![D\_Mitri\_Tompkins](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@D\_Mitri\_Tompkins](https://forum.inductiveautomation.com/u/D_Mitri_Tompkins)\
**Post date:** [July 3, 2024, 8:37pm UTC](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108/47 "2024-07-03T20:37:48Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/5/c5c732707edb91b34c3777cadb141bbacf44afd3.png)  
And this is the tags it currently goes to as well as how it is currently configured ahead of the transform script.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/f/0f26ad7a7f80813fc4a71a1cdf26bd53005fc85a.png)

---

<div class="post-metadata">

**Author:** ![D\_Mitri\_Tompkins](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@D\_Mitri\_Tompkins](https://forum.inductiveautomation.com/u/D_Mitri_Tompkins)\
**Post date:** [July 3, 2024, 8:40pm UTC](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108/48 "2024-07-03T20:40:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![D\_Mitri\_Tompkins](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@D\_Mitri\_Tompkins](https://forum.inductiveautomation.com/u/D_Mitri_Tompkins)\
**Post date:** [July 3, 2024, 8:47pm UTC](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108/49 "2024-07-03T20:47:16Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [July 3, 2024, 9:04pm UTC](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108/50 "2024-07-03T21:04:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [July 3, 2024, 9:40pm UTC](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108/51 "2024-07-03T21:40:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![D\_Mitri\_Tompkins](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@D\_Mitri\_Tompkins](https://forum.inductiveautomation.com/u/D_Mitri_Tompkins)\
**Post date:** [July 3, 2024, 11:32pm UTC](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108/52 "2024-07-03T23:32:23Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [July 3, 2024, 11:35pm UTC](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108/53 "2024-07-03T23:35:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![D\_Mitri\_Tompkins](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@D\_Mitri\_Tompkins](https://forum.inductiveautomation.com/u/D_Mitri_Tompkins)\
**Post date:** [July 3, 2024, 11:35pm UTC](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108/54 "2024-07-03T23:35:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![D\_Mitri\_Tompkins](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@D\_Mitri\_Tompkins](https://forum.inductiveautomation.com/u/D_Mitri_Tompkins)\
**Post date:** [July 3, 2024, 11:49pm UTC](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108/55 "2024-07-03T23:49:24Z")

</div>

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](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/2/02498b5cfabfba84df350bac930c6d683c81fa75.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/9/d9671b3588cb2444677909789e3020dae2532bd3.png)

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

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/f/0f9dc5c97e96a94e72d2ebd8c55ccfa98eef8e47.png)  
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.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [July 4, 2024, 7:03am UTC](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108/56 "2024-07-04T07:03:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![D\_Mitri\_Tompkins](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@D\_Mitri\_Tompkins](https://forum.inductiveautomation.com/u/D_Mitri_Tompkins)\
**Post date:** [July 4, 2024, 3:15pm UTC](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108/57 "2024-07-04T15:15:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![D\_Mitri\_Tompkins](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@D\_Mitri\_Tompkins](https://forum.inductiveautomation.com/u/D_Mitri_Tompkins)\
**Post date:** [July 4, 2024, 7:10pm UTC](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108/58 "2024-07-04T19:10:02Z")

</div>

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

I have this tag:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/6/f662268f72110494990670fb48a5f6682cd3fba0.png)  
It tracks the current amount of pounds per minute a laser line is moving.

I also have these setpoint calculating custom values:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/d/bd4dce16852078a0988afa10306083214a9bdbb9.png)  
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.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [July 5, 2024, 1:12pm UTC](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108/59 "2024-07-05T13:12:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![D\_Mitri\_Tompkins](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@D\_Mitri\_Tompkins](https://forum.inductiveautomation.com/u/D_Mitri_Tompkins)\
**Post date:** [July 8, 2024, 3:06pm UTC](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108/60 "2024-07-08T15:06:28Z")

</div>

Exact error Message is as follows:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/6/265713e5a4251bd439006252cc56d0ab42094378.png)

This is the custom dataset exactly, apologies it currently has no info in it:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/1/91369c5b0069d8d5d2437ef6c4fb3377ed525727.png)

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [July 8, 2024, 3:10pm UTC](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108/61 "2024-07-08T15:10:29Z")

</div>

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

```python
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)

```

[Previous page](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108.md?page=2)

[Next page](https://forum.inductiveautomation.com/t/any-help-or-insight-on-how-this-might-have-been-done/92108.md?page=4)
