# How to recreate this scripting with something like a derived or reference tag?

**URL:** <https://forum.inductiveautomation.com/t/how-to-recreate-this-scripting-with-something-like-a-derived-or-reference-tag/97695>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [October 23, 2024, 9:04pm UTC](https://forum.inductiveautomation.com/t/how-to-recreate-this-scripting-with-something-like-a-derived-or-reference-tag/97695 "2024-10-23T21:04:35Z")\
**Posts on this page:** 5\
**Page:** 2

<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:** [October 28, 2024, 2:32pm UTC](https://forum.inductiveautomation.com/t/how-to-recreate-this-scripting-with-something-like-a-derived-or-reference-tag/97695/21 "2024-10-28T14:32:30Z")

</div>

Oh my goodness gracious sir thank you so much, my hang ups were in the assigning of all the parameters, for some reason that didn't seem to me like I was doing the right thing, and it caused me to get lost.  
Thank you!

---

<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:** [October 29, 2024, 10:58pm UTC](https://forum.inductiveautomation.com/t/how-to-recreate-this-scripting-with-something-like-a-derived-or-reference-tag/97695/22 "2024-10-29T22:58:47Z")

</div>

> [@lrose](#):
>
> ```python
> def updateData(data, sample):
> historyDs = data['tag_history']
> conversion = data['CheckWeigh_Conversion']
> difference = abs(historyDs.getValueAt(1,1) - historyDs.getValueAt(0,1))
> pounds = difference * conversion
> data['pounds'] = round(pounds,1)
> 
> ```

And never mind, running into all sorts of issues with pulling the data in and more with making it usable I think I will just have to call this a total fail / something I can't make happen. There's too much that has to happen to the tag, and then it has to historized.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [October 30, 2024, 12:58am UTC](https://forum.inductiveautomation.com/t/how-to-recreate-this-scripting-with-something-like-a-derived-or-reference-tag/97695/23 "2024-10-30T00:58:36Z")

</div>

> [@D\_Mitri\_Tompkins](#):
>
> There's too much that has to happen to the tag, and then it has to historized.

I haven’t seen anything that isn’t attainable in this thread, though I’m not entirely certain I understand exactly what you’re trying to accomplish.

What do you mean by “and then it has to be historized”. In order to run a tag history query/binding the tag by definition is already historized.

Can you lay out clearly exactly what your goal is?

Because the examples I gave should sublimate exactly what you were already doing in the binding and transform. So what “issues” are you running into.

---

<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:** [October 30, 2024, 3:34pm UTC](https://forum.inductiveautomation.com/t/how-to-recreate-this-scripting-with-something-like-a-derived-or-reference-tag/97695/24 "2024-10-30T15:34:53Z")

</div>

So to preface, all or most of what I am talking about that is "already happening" with this tag

There is a tag that is currently used elsewhere in perspective (bound to a label) and in its raw form it seems to just count up the value infinitely, as seen here:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/optimized/3X/a/b/abebfbd752d5eaebcfc07658f043f423b65adffa_2_690x15.png)

So to my understanding the history binding that the label binding currently employs is used so that you can see "today's number" by subtracting the most recent value (or "(0,1)") from yesterday's value (that being "(1,1)") to get the count for just today.

This IS all well and fine yes, the problem is that for the report, I need to transform the tag in the same way, as in pull the "daily" value but I Also need the report to show how that value changes across the span of a week (That being the historizing I referred to previous)

In order to do that I am running into issue after issue, issues with timeframes, how to set a range of "Beginning of {currentweek} to {now}", and how to make it both modify the value to be "daily" usable, and record it across Multiple days

---

<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:** [October 30, 2024, 7:12pm UTC](https://forum.inductiveautomation.com/t/how-to-recreate-this-scripting-with-something-like-a-derived-or-reference-tag/97695/25 "2024-10-30T19:12:55Z")

</div>

I hope that's clearer, apologies if it isn't.

[Previous page](https://forum.inductiveautomation.com/t/how-to-recreate-this-scripting-with-something-like-a-derived-or-reference-tag/97695.md?page=1)
