# Garbage Historian value getting looged in database

**URL:** <https://forum.inductiveautomation.com/t/garbage-historian-value-getting-looged-in-database/71228>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [March 17, 2023, 1:14pm UTC](https://forum.inductiveautomation.com/t/garbage-historian-value-getting-looged-in-database/71228 "2023-03-17T13:14:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sourabh\_Ambildhuke](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@Sourabh\_Ambildhuke](https://forum.inductiveautomation.com/u/Sourabh_Ambildhuke)\
**Post date:** [March 17, 2023, 1:14pm UTC](https://forum.inductiveautomation.com/t/garbage-historian-value-getting-looged-in-database/71228/1 "2023-03-17T13:14:52Z")

</div>

Hello all,

We are stuck in an unexpected issue and are evaluating cause.

Issue-  
We have s7-300 machine connected to our ignition application giving 2 tag values namely prod\_count & status with history enabled. We have written tag event script & quality event script to check plc make and write value to line status.  
We have seen that when machine status changes to 1, the prod\_count history value is stored with older value sometime and then our OEE calculations get disrupted.  
So, like when current prod count is 10001 and status changes to 0 prod\_count new value is 9500 and when status value is 1 this value goes to 10002. so we have to check why is it behaving like.  
Appreciate your time in reading this long issue.  
Ignition - 8.1.18

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 17, 2023, 1:52pm UTC](https://forum.inductiveautomation.com/t/garbage-historian-value-getting-looged-in-database/71228/2 "2023-03-17T13:52:10Z")

</div>

Simple error in timing assumptions on your part. OPC subscriptions don't guarantee any particular order of delivery, so the arrival of a trigger in one tag doesn't mean another tag will already be up-to-date too.

The answer, in Ignition, is to subscribe for a trigger, but use an OPC read after the trigger to get all other values to be saved. You can script this, or use a SQL bridge module's transaction group set to OPC read mode. The tag historian cannot do this.
