It is currently Sun Jul 27, 2014 8:14 pm




Post new topic Reply to topic  [ 7 posts ] 
 Custom update in Transaction groups 
Author Message
Cadet
Cadet

Joined: Sat Feb 11, 2012 7:16 am
Posts: 5
Post 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


Thu Feb 23, 2012 6:50 am
Profile
Moderator
Moderator

Joined: Sun Apr 02, 2006 2:46 pm
Posts: 1982
Location: Sacramento, CA
Post Re: Custom update in Transaction groups
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.

_________________
Travis Cox
Inductive Automation
Technical Support Rep.


Thu Feb 23, 2012 9:39 am
Profile WWW
Cadet
Cadet

Joined: Sat Feb 11, 2012 7:16 am
Posts: 5
Post Re: Custom update in Transaction groups
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).


Thu Feb 23, 2012 10:03 am
Profile
General
General

Joined: Tue May 31, 2011 6:27 am
Posts: 313
Location: Minnesota
Post Re: Custom update in Transaction groups
arian.mares wrote:
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).


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.


Thu Feb 23, 2012 11:09 am
Profile
Cadet
Cadet

Joined: Sat Feb 11, 2012 7:16 am
Posts: 5
Post Re: Custom update in Transaction groups
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;


Sun Feb 26, 2012 9:17 am
Profile
General
General

Joined: Tue May 31, 2011 6:27 am
Posts: 313
Location: Minnesota
Post Re: Custom update in Transaction groups
arian.mares wrote:
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;


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.


Sun Feb 26, 2012 2:30 pm
Profile
Moderator
Moderator

Joined: Sun Apr 02, 2006 2:46 pm
Posts: 4046
Location: Sacramento, CA
Post Re: Custom update in Transaction groups
Sounds like you're describing exactly what a block group does, have you looked at them?

_________________
Carl Gould
Co-Director, Software Engineering
Inductive Automation


Tue May 08, 2012 10:38 am
Profile WWW
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: