# Subscribe tagchange with previous/current values 8.0 +

**URL:** <https://forum.inductiveautomation.com/t/subscribe-tagchange-with-previous-current-values-8-0/35233>\
**Category:** Module Development\
**Created:** [June 1, 2020, 10:38pm UTC](https://forum.inductiveautomation.com/t/subscribe-tagchange-with-previous-current-values-8-0/35233 "2020-06-01T22:38:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [June 1, 2020, 10:38pm UTC](https://forum.inductiveautomation.com/t/subscribe-tagchange-with-previous-current-values-8-0/35233/1 "2020-06-01T22:38:58Z")

</div>

How do you get the previous/current value of a tag using context.getTagManager().subscribeAsync ?

I see com.inductiveautomation.ignition.common.util.FilteredTagChangeListener.FilteredTagChangeEvent that looks like it has what I want but haven’t been able to implement it.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [June 1, 2020, 10:42pm UTC](https://forum.inductiveautomation.com/t/subscribe-tagchange-with-previous-current-values-8-0/35233/2 "2020-06-01T22:42:58Z")

</div>

What have you tried doing so far?

It looks like you can subclass `FilteredTagChangeListener` and provide it as your listener to `subscribeAsync`.

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [June 1, 2020, 11:24pm UTC](https://forum.inductiveautomation.com/t/subscribe-tagchange-with-previous-current-values-8-0/35233/3 "2020-06-01T23:24:53Z")

</div>

How do you pass in the 2nd parameter? java.util.EnumSet\<FilteredTagChangeListener.TagChangeType\> allowedChanges

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [June 1, 2020, 11:35pm UTC](https://forum.inductiveautomation.com/t/subscribe-tagchange-with-previous-current-values-8-0/35233/4 "2020-06-01T23:35:08Z")

</div>

Just build an `EnumSet` of `TagChangeType`s?

e.g. `EnumSet.of(TagChangeType.ValueChange)`

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [June 1, 2020, 11:36pm UTC](https://forum.inductiveautomation.com/t/subscribe-tagchange-with-previous-current-values-8-0/35233/5 "2020-06-01T23:36:10Z")

</div>

There’s also nothing special about this listener. It’s just a listener that happens to remember the last value for any given tag path and deliver that in its own event type via the `onFilteredTagChange` method you override. Plus some options for suppressing initial events and filtering certain changes. It’s used by the gateway tag change scripts.
