Custom update in Transaction groups

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

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.

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=“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.

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=“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.

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