# Transaction Group: Using datetime as a key

**URL:** <https://forum.inductiveautomation.com/t/transaction-group-using-datetime-as-a-key/33250>\
**Category:** Ignition\
**Created:** [March 19, 2020, 6:44pm UTC](https://forum.inductiveautomation.com/t/transaction-group-using-datetime-as-a-key/33250 "2020-03-19T18:44:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![audreyt](https://avatars.discourse-cdn.com/v4/letter/a/b5e925/32.png) [@audreyt](https://forum.inductiveautomation.com/u/audreyt)\
**Post date:** [March 19, 2020, 6:44pm UTC](https://forum.inductiveautomation.com/t/transaction-group-using-datetime-as-a-key/33250/1 "2020-03-19T18:44:43Z")

</div>

I have a transaction group that executes (every second) based on two key/value pairs. One pair is a string, and the other is a datetime object. The datetime tag value changes only once every few minutes. (Its format is `yyyy-MM-dd hh:mm:ss`, if that’s relevant at all.)

When I have the group use just the string pair, it updates or inserts exactly how you’d expect. However, when I have the group use the datetime pair (either alone or in conjunction with the string pair), the group inserts a new row every execution, even if the datetime value hasn’t changed at all; I’ve yet to see it match and update when using the datetime pair.

Do the transaction group key/value pair updates just not work with datetime pairs? Or is there some subtle difference between what’s in the tag and what gets stored into the (MySQL) database by default that causes it to mismatch, and how can I address that?

---

<div class="post-metadata">

**Author:** ![audreyt](https://avatars.discourse-cdn.com/v4/letter/a/b5e925/32.png) [@audreyt](https://forum.inductiveautomation.com/u/audreyt)\
**Post date:** [March 20, 2020, 6:29pm UTC](https://forum.inductiveautomation.com/t/transaction-group-using-datetime-as-a-key/33250/2 "2020-03-20T18:29:04Z")

</div>

Update!

Not sure about an actual solution to the issue, but at the very least, a workaround: creating a duplicate of my datetime tag, using that tag in the transaction group, and having its data stored in a string column rather than a datetime column. Then the key/value check looks at the new datetime-string column instead of the actual datetime column and hey, it works. The string column seems to store the value in a way that allows it to match what’s in the tag when it’s read back out.

So there’s a little bit of duplication now, which is unfortunate, but at the very least the group updates and inserts as appropriate, and I still have my original datetime column to query on for reporting.
