# How to implement Accumulator

**URL:** <https://forum.inductiveautomation.com/t/how-to-implement-accumulator/9952>\
**Category:** Ignition\
**Created:** [April 24, 2015, 1:13am UTC](https://forum.inductiveautomation.com/t/how-to-implement-accumulator/9952 "2015-04-24T01:13:38Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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:** [April 24, 2015, 8:52pm UTC](https://forum.inductiveautomation.com/t/how-to-implement-accumulator/9952/4 "2015-04-24T20:52:22Z")

</div>

_EDIT: 2020-09-11 Edited to new forum format_

Using only SQLTags:  
The Trigger tag doas all the work.

In the Expression/SQL section:

```auto
if({[.]Filling},
   (if((dateextract(now(),"sec")/2)=toInt((dateextract(now(),"sec")/2)),1,0)+1),
   0)

```

In the Tag Events/Value Changed Script:

```python
if currentValue>0:
	flow=system.tag.read("[Client]Accumulator Test (JC)/Flow").value/60
	total=system.tag.read("[Client]Accumulator Test (JC)/Total").value
	system.tag.write("[Client]Accumulator Test (JC)/Total",total+flow)

```

The file below will import the tags into [Client]Accumulator Test (JC) (because I’m pretty sure you won’t already have a folder with that name… 😆 )

On last thing: when the tags import, the Trigger tag will show an error. This is because it couldn’t initially bind to the Filling tag. Just open the tag in the editor and click Apply, and that should be taken care of. ![:thumb_right:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/2026e28c0c425034352c1b75807edf956adc75f4.gif ":thumb\_right:")

Hope this helps!  
[Accumulator Test (JC) sqltags.xml](https://us1.discourse-cdn.com/inductiveautomation/original/2X/4/43466300ad464cf64f2297f449c9fa65d596be0a.xml) (1.32 KB)

---

_[View the full topic](https://forum.inductiveautomation.com/t/how-to-implement-accumulator/9952)._
