It is currently Thu Apr 24, 2014 8:57 am




Post new topic Reply to topic  [ 3 posts ] 
 Write SQL Tabke 
Author Message
Trooper
Trooper

Joined: Mon May 21, 2012 9:51 am
Posts: 12
Post Write SQL Tabke
Hi, I need writing values that I'm reading online "PLC" to SQL table.
Every time my table was modified, I have debouts correct scripts for this function.

Tables= Pressure Process
Column1= PS1
Column2= PS2

Thanks


Thu Jun 28, 2012 9:47 am
Profile
Moderator
Moderator

Joined: Sun Apr 02, 2006 2:46 pm
Posts: 1982
Location: Sacramento, CA
Post Re: Write SQL Tabke
You should use a transaction group to write values from the PLC to the database. You can use the standard group setting the mode from OPC->DB. You just need to map each PLC tag to a column in the database table. If you want bi-directional synchronization you can set the mode to Bi-Directional OPC Wins.

_________________
Travis Cox
Inductive Automation
Technical Support Rep.


Thu Jun 28, 2012 10:27 am
Profile WWW
Moderator
Moderator

Joined: Sun Apr 02, 2006 3:43 pm
Posts: 2418
Post Re: Write SQL Tabke
Hi,

Are you using FactorySQL or Ignition? If Ignition, are you using the SQL Bridge module? If so, or if FactorySQL, you just need to add the two items to a standard group (or a historical group), and then on the trigger panel select "Async Trigger" or "Only evaluate when values have changed" option (the names are a little different between the two programs).

If you're using Ignition and want to do it in scripting, I would just create a gateway tag change script that listens to the tags you want, and then use the system.tag.read() and system.db.runPrepQuery() functions. The documenation for read() has an example of using both of them together.

Hope this helps,

_________________
Colby Clegg
Inductive Automation
Software Development


Thu Jun 28, 2012 10:30 am
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 


Who is online

Users browsing this forum: No registered users and 0 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: