# Transaction Groups with Null Values

**URL:** <https://forum.inductiveautomation.com/t/transaction-groups-with-null-values/3280>\
**Category:** Ignition\
**Created:** [September 12, 2011, 7:57pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-with-null-values/3280 "2011-09-12T19:57:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [September 12, 2011, 7:57pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-with-null-values/3280/1 "2011-09-12T19:57:57Z")

</div>

Hey all,

Is it possible to create a transaction group that will only record a changed value for the tag that changed and write nulls to everything else? Something like this:

code1 code2 code3  
Null 81 Null  
32 Null Null  
Null Null 65

I have 26 inverters I’m trying to collect error codes from but everytime one error code changes it writes all of the values from every inverter into the row even if the error code did not change.

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [September 12, 2011, 8:42pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-with-null-values/3280/2 "2011-09-12T20:42:19Z")

</div>

Well, I guess you could with quite a bit of work:

1. Make all of your opc items read-only.
2. For each opc item, make an expression item:

```auto
if(hasChanged({opcitem}),{opcitem},toInt(null))
```

The “toInt” is a bit of a hack to work around a type checking problem in the “if” statement right now. If you just put null, it will complain that the type isn’t right.  
3) Have that expression target the column you want to write to.  
4) For the trigger, you could use the async mode (select the expression items), but then you’ll get a secondary record with all nulls after the real row logs. So, you need a trigger expression item:

```auto
if(isNull({expression1}) && isNull({expression2})..., 0, 1)
```

So, if all items are null, return 0, else 1.  
5) Trigger on that item being \>0.

Note: all of those expression items are “run-always”.

Now, maybe a simpler thing to do:

1. Create a block group, put all of your items into a single block item called “values”. Write to some column.
2. Copy and paste the block item, and change the value property to “path”. Write to a different column.
3. Set the group to insert changed rows.  
This will log changes into a table like ‘path, value’, with a row for each change.

Hope this helps,

---

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [September 12, 2011, 10:13pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-with-null-values/3280/3 "2011-09-12T22:13:37Z")

</div>

The second way of doing it would work perfectly, but I can’t find a property named “path” anywhere in the group settings. There is a “Name” property but it seems to put the same values into the second column as the first “value” block group does. Am I missing a setting somewhere?

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [September 12, 2011, 10:48pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-with-null-values/3280/4 "2011-09-12T22:48:06Z")

</div>

You’re right, I meant “Name”.

What version of Ignition are you using? There was a bug with that feature prior to 7.2.8, but I believe the fix made it in that release.

Are you using SQLTag references or OPC Items? I’m guessing SQLTags… since the bug only related to those. Is it possible to try with direct opc addresses?

Also, just to confirm that it’s set up correctly: When you change the value property to “name”, the item gets a new icon (a little “f(x)”) under the “properties” column in the table, right?

Regards,

---

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [September 12, 2011, 11:12pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-with-null-values/3280/5 "2011-09-12T23:12:32Z")

</div>

I am using 7.2.8 and I am using SQL Tags. I do get the f(x) symbol in the properties column when I select “name” so I’ll try it with OPC tags and see if that takes care of it. If it does work I’ll let you know, thanks!

---

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [September 12, 2011, 11:34pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-with-null-values/3280/6 "2011-09-12T23:34:22Z")

</div>

Beautiful, it does indeed work with OPC values. Thanks, Colby! I guess that bug wasn’t fixed in 7.2.8 😛

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [September 14, 2011, 5:03pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-with-null-values/3280/7 "2011-09-14T17:03:22Z")

</div>

Er, ok, I’ll have to make sure it’s really in for 7.2.9.

Regards,

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [July 29, 2016, 5:41pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-with-null-values/3280/8 "2016-07-29T17:41:59Z")

</div>

Im doing this same thing but in reverse, i am reading a DB value to an OPC tag. The problem is that the DB uses NULL values, when the NULL values are written to an OPC tag it fails. How can I incorporate the expression but reading the DB column in a transaction group?

Thanks,  
Drew

---

<div class="post-metadata">

**Author:** ![anna](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@anna](https://forum.inductiveautomation.com/u/anna)\
**Post date:** [March 1, 2017, 6:13pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-with-null-values/3280/9 "2017-03-01T18:13:47Z")

</div>

It has been a while - Drew, is this still an issue for you?
