# Logging totalizer\* every 15 minutes + report

**URL:** <https://forum.inductiveautomation.com/t/logging-totalizer-every-15-minutes-report/74326>\
**Category:** Ignition\
**Tags:** ignition78, vision\
**Created:** [May 31, 2023, 3:17am UTC](https://forum.inductiveautomation.com/t/logging-totalizer-every-15-minutes-report/74326 "2023-05-31T03:17:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrews](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@andrews](https://forum.inductiveautomation.com/u/andrews)\
**Post date:** [May 31, 2023, 3:17am UTC](https://forum.inductiveautomation.com/t/logging-totalizer-every-15-minutes-report/74326/1 "2023-05-31T03:17:31Z")

</div>

So I need to log data every 15 minutes off a flowmeter.  
I need to grab GPM, Grand Total, Flow (gallons for last 15 minutes.) All in a PLC.

System is 7.8.5 and does have transaction module but not reporting module.

So every 15 minutes I can grab the GPM and the grand total. Flow would just be current grand total - last grand total.

I'm thinking I can use a gateway script to record every 15 minutes and save to DB. Then use **system.dataset.exportExcel** to toss the recordings for the last 24 hours into a folder on the server. And then possibly prune the last 24 because its already been recorded.  
If possible I'd like to limit the amount of files in the folder. and name with date for ease of use.

looking for best practices or better ideas.

Data would need to look like this in the report.  
|

```auto
Date|Time (HH:MM:SS)|Totalizer read (Gallons)|Total Flow (Gallons)|Flow Rate (GPM)|
| --- | --- | --- | --- | --- |
|June 1|00:00:00|651,185,326|786|52|
|June 1|00:15:00|651,186,177|851|56|
|June 1|00:30:00|651,187,653|1476|98.4|
|June 1|00:45:00|651,188,888|1235|82|

```

Can I do a calculation previous grand total minus current in the transaction group? Or would this need be a tag change script writing to a new tag. would I need to offset it by a min to avoid a race condition?

---

<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:** [May 31, 2023, 10:07am UTC](https://forum.inductiveautomation.com/t/logging-totalizer-every-15-minutes-report/74326/2 "2023-05-31T10:07:13Z")

</div>

> [@andrews](#):
>
> Can I do a calculation previous grand total minus current in the transaction group?

You could use a query expression item to get the last row in the table, but it would probably be more efficient to use a LEAD or LAG in the query you use to generate the report.

---

<div class="post-metadata">

**Author:** ![andrews](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@andrews](https://forum.inductiveautomation.com/u/andrews)\
**Post date:** [June 2, 2023, 1:09am UTC](https://forum.inductiveautomation.com/t/logging-totalizer-every-15-minutes-report/74326/3 "2023-06-02T01:09:51Z")

</div>

Thanks, thats a good idea. I just used a counter in the PLC in the meantime.
