# Production info in tags

**URL:** <https://forum.inductiveautomation.com/t/production-info-in-tags/19037>\
**Category:** Ignition\
**Created:** [July 31, 2018, 7:08pm UTC](https://forum.inductiveautomation.com/t/production-info-in-tags/19037 "2018-07-31T19:08:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![juang](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@juang](https://forum.inductiveautomation.com/u/juang)\
**Post date:** [July 31, 2018, 7:08pm UTC](https://forum.inductiveautomation.com/t/production-info-in-tags/19037/1 "2018-07-31T19:08:08Z")

</div>

Hi, i have the following situation, i have a blower which has some of the following tags in s7 400

Time since last reset  
Machine rotation time since last reset.  
Good Bottles since last reset.  
bad bottles since last reset.  
and more but same situation.

currently we are resetting the information from the HMi from the blower. which keeps a record of the period and the information, and resets the counters to 0.

right now we use it per run, so we run a orange soda when we finished the operator finished the run and a new run starts.

what i would like to do is the following.

keep record of not only the run, but by shift, day or anyway i would like to do it.

so i have the tags created in ignition and can see the values. i don’t really know how to separte this values since last reset to a shift or day values. since the problem is that when it restarts a run it would clear everything.

ideally it would be to have a

Shift start time  
shift Machine rotation time  
shift Good Bottles.  
shift bad bottles  
and so on.

so im not really sure how to create a tag or tags to keep this memory. anybody help would be aprpeciated im really stuck in this and need this to calculate. production efficiency per shift, per day, or per date range. so far the way i have it i can only calculate per reset.  
when they press the push button i recoed the values in a transaction group, if succes, i then set the value in the plc to actually reset the counters to 0. but this is only per run. and i can have a run that can go more than 1 shift. and sometimes i have many runs in one shift.

Thank you

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [July 31, 2018, 7:15pm UTC](https://forum.inductiveautomation.com/t/production-info-in-tags/19037/2 "2018-07-31T19:15:16Z")

</div>

Create a boolean tag in the plc called ReadyToLog or some such.  
Set the boolean to true on completion of a production run.  
Then create a Transaction Group in Ignition that is triggered by that boolean being true, and stores the values to a database table.  
The Transaction group then resets the boolean to false after logging the values.

---

<div class="post-metadata">

**Author:** ![juang](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@juang](https://forum.inductiveautomation.com/u/juang)\
**Post date:** [July 31, 2018, 7:31pm UTC](https://forum.inductiveautomation.com/t/production-info-in-tags/19037/3 "2018-07-31T19:31:42Z")

</div>

Thanks i know how to trigger the group and how to record that is not the problem i’m having.

the problems is to be able to separte a per shift, per run, per hour, or day values.

---

<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:** [July 31, 2018, 7:36pm UTC](https://forum.inductiveautomation.com/t/production-info-in-tags/19037/4 "2018-07-31T19:36:33Z")

</div>

Don’t reset the counters. Treat them as odometers. Record regularly (as often as you might need to report). Use lag() window functions in SQL to generate deltas from the last entry in a time period to the last entry in the previous time period. Include a modulus function to catch odometer rollover.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [July 31, 2018, 7:45pm UTC](https://forum.inductiveautomation.com/t/production-info-in-tags/19037/5 "2018-07-31T19:45:21Z")

</div>

Or if you are recording to a database look into how to use the GROUP BY clause in queries to summarize data by date ranges.

---

<div class="post-metadata">

**Author:** ![juang](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@juang](https://forum.inductiveautomation.com/u/juang)\
**Post date:** [July 31, 2018, 7:46pm UTC](https://forum.inductiveautomation.com/t/production-info-in-tags/19037/6 "2018-07-31T19:46:07Z")

</div>

thank you, not really sure how to create this if you could give me an example would be great

---

<div class="post-metadata">

**Author:** ![juang](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@juang](https://forum.inductiveautomation.com/u/juang)\
**Post date:** [August 1, 2018, 11:53pm UTC](https://forum.inductiveautomation.com/t/production-info-in-tags/19037/7 "2018-08-01T23:53:55Z")

</div>

Got it to work on creating 3 tags. for what i wanted. which is not great but works correctly.

so i made  
Current Tag Value from PLC  
Saved Tag Memory Tag  
FinalTotal Expression Tag. Current+saved.

I record. Final to Sql every one second, and update final also every one second.

when operator reset plc HMI. i move final to save, then clear current, and star counting again.

this way i don’t have to modify the HMI for the blower which i don’t have the source code for the Sidel Machine. and i treat the finaltotal as an odometer.

so thanks for the help. i got some good ideas.
