# Table and machine monitoring use

**URL:** <https://community.tulip.co/t/table-and-machine-monitoring-use/477>\
**Category:** Support, Troubleshooting, & Help\
**Tags:** tables, machines, dev\
**Created:** [June 18, 2020, 1:07pm UTC](https://community.tulip.co/t/table-and-machine-monitoring-use/477 "2020-06-18T13:07:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![FahdERM](https://avatars.discourse-cdn.com/v4/letter/f/ce7236/32.png) [@FahdERM](https://community.tulip.co/u/FahdERM)\
**Post date:** [June 18, 2020, 1:07pm UTC](https://community.tulip.co/t/table-and-machine-monitoring-use/477/1 "2020-06-18T13:07:19Z")

</div>

Hello guys,  
I am developping an app base on machine monitoring and tables at the same time. So, what i want to do is to get a counter value from a machine over the OPC server, save this value (Counter\_piece for example) every 10 minutes using a trigger in the master layout (untill now evething is okay). My problem begin now. With this counter i have also to create two other tables : one to save the value of counter\_piece(N-1) (the value of counter\_piece that i have saved &à minutes before) and an other one for susbstaction result between (counter\_piece(N) - counter\_piece(N-1)). So my question is how can i do save the value of counter\_piece(N) (10 minute ago) into the new table counter\_piece(N-1) and do this every 10 minutes)?  
thank you for your help,

---

<div class="post-metadata">

**Author:** ![MoPositive](https://avatars.discourse-cdn.com/v4/letter/m/c5a1d2/32.png) [@MoPositive](https://community.tulip.co/u/MoPositive)\
**Post date:** [July 1, 2020, 3:13pm UTC](https://community.tulip.co/t/table-and-machine-monitoring-use/477/2 "2020-07-01T15:13:10Z")

</div>

Do you really mean tables when you say tables or are you just talking about holding on to these values in variables for the 10 minute intervals?

If you really mean tables, I don’t see why you need 2 separate tables for N and N-1. Make a table with an ID column, a column for N and a . When you get a new N value, create a new table record and grab the ID of that record. Use that to get the N value for record ID - 1, subtract it from your current N and you have your difference variable. You could store that difference value in the table but it’s always available by doing the math on your column of Ns.

---

<div class="post-metadata">

**Author:** ![FahdERM](https://avatars.discourse-cdn.com/v4/letter/f/ce7236/32.png) [@FahdERM](https://community.tulip.co/u/FahdERM)\
**Post date:** [July 3, 2020, 9:36am UTC](https://community.tulip.co/t/table-and-machine-monitoring-use/477/3 "2020-07-03T09:36:44Z")

</div>

Okay i see. But my only problem is that i am using IDs based on our number of WO i mean if for example we are working on the WO ‘001’ i will create a table record with the ID : 001-“Randomstring()” so is it possible to create for example the new record with this ID and at the same Time save this ID to use it when i will do the math substraction of the two records (N and N-1)?  
thank you,

---

<div class="post-metadata">

**Author:** ![MoPositive](https://avatars.discourse-cdn.com/v4/letter/m/c5a1d2/32.png) [@MoPositive](https://community.tulip.co/u/MoPositive)\
**Post date:** [July 3, 2020, 3:12pm UTC](https://community.tulip.co/t/table-and-machine-monitoring-use/477/4 "2020-07-03T15:12:25Z")

</div>

I think the answer is to not use your work order information as the ID for the table record. Keep a separate ID column and let it auto-increment.
