# Looking for a solution to an unnecessarily difficult problem I've had : deriving separate values from the same tag source

**URL:** <https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506>\
**Category:** Ignition\
**Created:** [March 18, 2024, 5:44pm UTC](https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506 "2024-03-18T17:44:55Z")\
**Posts on this page:** 20\
**Page:** 1

<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:** [March 18, 2024, 5:44pm UTC](https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506/1 "2024-03-18T17:44:55Z")

</div>

I am very new and inexperienced to ignition, I have a tag that I Believe is a part of a so called tag database that keeps a sorta "lifetime" count of how many pallets have come off the palletizer. I believed I had found the solution here before by using integer expression tags to take a "snapshot" of the "lifetime" value at a set time so could then subtract values from each other, the problem being that it ended up interfering with other labels tag displays, causing them to also "snapshot" leading to a bunch of negative tag values. Anyone know of another way to do this? And sorry for technically re-asking a question I asked before but currently just spinning my wheels.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [March 18, 2024, 5:57pm UTC](https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506/2 "2024-03-18T17:57:03Z")

</div>

Can you make a tag in the PLC that _is_ an actual lifetime counter?

---

<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:** [March 18, 2024, 6:01pm UTC](https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506/3 "2024-03-18T18:01:13Z")

</div>

No I can't unfortunately, the tags are being pulled in from an MES database separate from all the other tags for the line, referencing the tags for the palletizer directly was causing total system shutdown for some reason so the tag that I'm trying to reference is within that "separate" MES database, though it still appears under the tag list / tag menu / whatever its called I am an idiot sorry haha.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [March 18, 2024, 6:02pm UTC](https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506/4 "2024-03-18T18:02:25Z")

</div>

What resets the current one to zero?

---

<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:** [March 18, 2024, 6:03pm UTC](https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506/5 "2024-03-18T18:03:15Z")

</div>

I'm not aware of if it ever resets, it seems to just tick up up up up forever? If it has a reset I'm not sure how to identify it.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [March 18, 2024, 6:06pm UTC](https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506/6 "2024-03-18T18:06:03Z")

</div>

All right, so we're grabbing this value at the start of the shift.

What values are going negative?

---

<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:** [March 18, 2024, 6:07pm UTC](https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506/7 "2024-03-18T18:07:25Z")

</div>

Values for labels on a totally separate screen, pulled from the same line as the palletizer but not through the MES

To better clarify my confusing explanations, there is a tag folder for the "Retail" and under that there is a sub folder for "MES"

The labels which used other tags under "Retail" were getting messed up.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [March 18, 2024, 6:08pm UTC](https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506/8 "2024-03-18T18:08:57Z")

</div>

What is causing the disparity between MES and the PLC?

EDIT: It seems that, if there is no equality between the two, then all of the values should be derived from either the PLC or the MES.

---

<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:** [March 18, 2024, 6:10pm UTC](https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506/9 "2024-03-18T18:10:33Z")

</div>

> [@D\_Mitri\_Tompkins](#):
>
> To better clarify my confusing explanations, there is a tag folder for the "Retail" and under that there is a sub folder for "MES"

This sounds like a side effect. What is writing to these labels?

---

<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:** [March 18, 2024, 6:11pm UTC](https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506/10 "2024-03-18T18:11:43Z")

</div>

Not exactly sure, the separation and everything is before I was hired, I just know that it had to be done for some reason.

---

<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:** [March 18, 2024, 6:12pm UTC](https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506/11 "2024-03-18T18:12:25Z")

</div>

Does "writing to" mean the tags that they reference for their text binding to show the values?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [March 18, 2024, 6:17pm UTC](https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506/12 "2024-03-18T18:17:59Z")

</div>

> [@D\_Mitri\_Tompkins](#):
>
> Does "writing to" mean the tags that they reference

Yep! 🙂

---

<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:** [March 18, 2024, 6:21pm UTC](https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506/13 "2024-03-18T18:21:59Z")

</div>

Writing to these labels is a couple different counts from the same retail line that I am trying to pull a palletizer count from, I will attach an example of this for one of the labels

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

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

These values were becoming negative and I had to change the value.getValueAt() - value.getValueAt() to only be one of the value.'s which fixed it for that day, then the next day I had to add the - value back, which made me realize the issue was likely to do with the "Snapshots" of data I was taking

---

<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:** [March 18, 2024, 6:32pm UTC](https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506/14 "2024-03-18T18:32:58Z")

</div>

Why would tag history be effected by an expression tag if all it was doing was reading a tag 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:** [March 18, 2024, 6:36pm UTC](https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506/15 "2024-03-18T18:36:58Z")

</div>

I replicated the following

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/6/06e8d7d859d632a40b988dbad76bafc97e90e7f5.png)

Using these two tags and a third tag which simply subtracted the count so far from the count from the snapshot actually successfully yielded me a pallet count, but it threw the other labels off.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [March 18, 2024, 6:39pm UTC](https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506/16 "2024-03-18T18:39:17Z")

</div>

All right we've got one successful one. That's a start 😉

What are you putting the history on? Is it the difference value?

---

<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:** [March 18, 2024, 6:40pm UTC](https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506/17 "2024-03-18T18:40:08Z")

</div>

Was the `Start Count` tag already in use?

---

<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:** [March 18, 2024, 6:43pm UTC](https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506/19 "2024-03-18T18:43:35Z")

</div>

No, just confirmed

---

<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:** [March 18, 2024, 6:44pm UTC](https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506/20 "2024-03-18T18:44:26Z")

</div>

Gosh I am so sorry here, but when you ask what I am putting the history on what do you mean? I apologize for my ineptitude.

---

<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:** [March 18, 2024, 6:46pm UTC](https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506/21 "2024-03-18T18:46:11Z")

</div>

I see no reason why this script would cause those labels to be negative. Unless you're dealing with an issue that was pre-existing.

Do you have many such "Tag Value Change scripts" in your system?

> [@D\_Mitri\_Tompkins](#):
>
> Gosh I am so sorry here, but when you ask what I am putting the history on what do you mean? I apologize for my ineptitude.

Nah, no worries. What tag are you storing the history on, for the "snapshot".

[Next page](https://forum.inductiveautomation.com/t/looking-for-a-solution-to-an-unnecessarily-difficult-problem-ive-had-deriving-separate-values-from-the-same-tag-source/87506.md?page=2)
