Read and Write DB table

Hi everyone,

I’m new to ignition and scripting, so this is no doubt a simple question.

I would like to have some buttons in my project to write to and from cells in a DB table.

Button 1 - Writes value from DB cell to PLC tag.

Button 2 - Writes PLC tag value to DB cell.

Can anyone point me in the right direction on this?


These scripts on the actionPerformed event on the button should do it for you.

value = system.db.runScalarQuery("SELECT value FROM table WHERE something = x") system.tag.write("Folder\Tag",value)

value ="Folder\Tag").value sql = "UPDATE table SET column = ? where something = x" system.db.runPrepUpdate(sql, [value])

Thats great, Thanks!

Ill give this a try in the morning.