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

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.

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

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.

What resets the current one to zero?

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.

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

What values are going negative?

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.

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.

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

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

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

Yep! :slight_smile:

1 Like

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

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

Why would tag history be effected by an expression tag if all it was doing was reading a tag value?

I replicated the following

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.

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

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

Was the Start Count tag already in use?

No, just confirmed

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.

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?

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