# Custom update in Transaction groups

**URL:** <https://forum.inductiveautomation.com/t/custom-update-in-transaction-groups/4052>\
**Category:** Ignition\
**Created:** [February 23, 2012, 2:50pm UTC](https://forum.inductiveautomation.com/t/custom-update-in-transaction-groups/4052 "2012-02-23T14:50:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![arian.mares](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@arian.mares](https://forum.inductiveautomation.com/u/arian.mares)\
**Post date:** [February 23, 2012, 2:50pm UTC](https://forum.inductiveautomation.com/t/custom-update-in-transaction-groups/4052/1 "2012-02-23T14:50:07Z")

</div>

Hi,

I need to update values in a table according to DatabaseTags values. The values are on different rows but in the same database field.

One idea was to introduce in the database a field named tag\_name and than update the values with a custom SQL expression able to check the tag’s name and compare it with the value in database field tag\_name.  
It doesn’t works because:

1. Standard Transaction Groups doesn’t allow to have multiple items that write in the same database field (even if are on different rows).  
One solution would be to have different Transaction Groups for each Database Tag but looks too complicate.

2. I don’t know how to write an expression in custom update Where clause that returns Tag’s name. There is somewhere a documentation of all objects that may be referred in such an expression?

Thank you,

Arian

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [February 23, 2012, 5:39pm UTC](https://forum.inductiveautomation.com/t/custom-update-in-transaction-groups/4052/2 "2012-02-23T17:39:56Z")

</div>

What exactly are you trying to do? When do you want to perform the updates? It might be easier to write a script than to use a transaction group.

---

<div class="post-metadata">

**Author:** ![arian.mares](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@arian.mares](https://forum.inductiveautomation.com/u/arian.mares)\
**Post date:** [February 23, 2012, 6:03pm UTC](https://forum.inductiveautomation.com/t/custom-update-in-transaction-groups/4052/3 "2012-02-23T18:03:19Z")

</div>

I have a table named io with, aprox this structure:

io\_id, io\_name, io\_value, io\_tag\_name.

This table have as many rows as many tags there are.

I’m trying to have always in this table the values for each tag.

There will be many tags (2000-3000).

---

<div class="post-metadata">

**Author:** ![Greg.Buehler](https://avatars.discourse-cdn.com/v4/letter/g/ecc23a/32.png) [@Greg.Buehler](https://forum.inductiveautomation.com/u/Greg.Buehler)\
**Post date:** [February 23, 2012, 7:09pm UTC](https://forum.inductiveautomation.com/t/custom-update-in-transaction-groups/4052/4 "2012-02-23T19:09:04Z")

</div>

[quote=“arian.mares”]I have a table named io with, aprox this structure:

io\_id, io\_name, io\_value, io\_tag\_name.

This table have as many rows as many tags there are.

I’m trying to have always in this table the values for each tag.

There will be many tags (2000-3000).[/quote]

It sounds like you might as well just stick everything in a Database Driven Provider. Ignition will store all the tags in a table (sqlt\_core) according to the schema found in [this document](http://files.inductiveautomation.com.s3.amazonaws.com/guides/sqltags_custom_driver_guide.pdf).

---

<div class="post-metadata">

**Author:** ![arian.mares](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@arian.mares](https://forum.inductiveautomation.com/u/arian.mares)\
**Post date:** [February 26, 2012, 5:17pm UTC](https://forum.inductiveautomation.com/t/custom-update-in-transaction-groups/4052/5 "2012-02-26T17:17:40Z")

</div>

Yes, I’ve defined a database driven provider but I want to use my table and I don’t want to INSERT but to UPDATE.  
In the transaction group parameters there is an ‘Action’ tab and there is a ‘table action’ zone. There I choose update/select.  
Here are 2 problems:

- how to write the ‘where’ clause in order to update the right record in the table (I need an expression like this: WHERE tag\_name={TagName}. Here {TagName} would be a function which returns the name of the current tag. Is there such a function? Can it be used in such way?
- in the same transaction group, two items can’t update the same field, even if those items would update two different rows in the table;

---

<div class="post-metadata">

**Author:** ![Greg.Buehler](https://avatars.discourse-cdn.com/v4/letter/g/ecc23a/32.png) [@Greg.Buehler](https://forum.inductiveautomation.com/u/Greg.Buehler)\
**Post date:** [February 26, 2012, 10:30pm UTC](https://forum.inductiveautomation.com/t/custom-update-in-transaction-groups/4052/6 "2012-02-26T22:30:41Z")

</div>

[quote=“arian.mares”]Yes, I’ve defined a database driven provider but I want to use my table and I don’t want to INSERT but to UPDATE.  
In the transaction group parameters there is an ‘Action’ tab and there is a ‘table action’ zone. There I choose update/select.  
Here are 2 problems:

- how to write the ‘where’ clause in order to update the right record in the table (I need an expression like this: WHERE tag\_name={TagName}. Here {TagName} would be a function which returns the name of the current tag. Is there such a function? Can it be used in such way?
- in the same transaction group, two items can’t update the same field, even if those items would update two different rows in the table;[/quote]

Right, I’m not trying to ignore your current idea, but if you have the data in a Database Driven Provider already, you can just update the records in that database and they will be reflected in Ignition. The database in a DDR is both written and read from using the provider.

Perhaps one of the Inductive guys can provide a little more insight.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [May 8, 2012, 6:38pm UTC](https://forum.inductiveautomation.com/t/custom-update-in-transaction-groups/4052/7 "2012-05-08T18:38:43Z")

</div>

Sounds like you’re describing exactly what a block group does, have you looked at them?
