# Tag Max Value no SQL

**URL:** <https://forum.inductiveautomation.com/t/tag-max-value-no-sql/35649>\
**Category:** Ignition\
**Created:** [June 15, 2020, 12:09pm UTC](https://forum.inductiveautomation.com/t/tag-max-value-no-sql/35649 "2020-06-15T12:09:18Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [June 15, 2020, 12:25pm UTC](https://forum.inductiveautomation.com/t/tag-max-value-no-sql/35649/2 "2020-06-15T12:25:01Z")

</div>

You can do this with my objectScript() expression function, thanks to its built-in state dictionary. Something like this:

```auto
objectScript("args[0] if not args[1] or state['mx'] is None or args[0] > state['mx'] else state.mx\nstate['mx'] = __retv",
  {path/to/value/to/track}, {path/to/condition/boolean})

```

Note the buried new-line code that ends the expression and provides an opportunity to execute the assignment into the `state` dictionary.

The above passes the value through when the condition is false, then captures max while true.

---

_[View the full topic](https://forum.inductiveautomation.com/t/tag-max-value-no-sql/35649)._
