Multiple OPCUA Items into SQL Database

Hey, I created different OPCU-Items to read Values from my PLC and store them in an Microsoft SQL Database.
If I use only one Item, read it with the OPCUA Client an write it to the Database with MSSQL-PLUS, everything is working. But if want to repeat it for more variables at the same time, I dont know how to adress them right.

This is the query(MSSQL-PLUS) I use at the moment to write to my Database for just one variable.

SET @value = {{payload}};


I think a good solution could be that I use the Client with the Action MULTIPLE READ and store the variables in an array, so I can adress them in the SQL Query and write each on to the right column. But I don't know how to get this array.

When you do the Read Multiple, you already get an array from the OPC-UA client. You just have to scan it and prepare the queries for each item (if they go on different lines) or do a single query with all the elements (if they go in a single line).

I do exactly that with function nodes, one to convert the array into an object with Key/value pairs (so it's human readable), then write the key/index fields into a MySQL DB, and store the whole object in JSON format as well. That way I can do searches, and if I need to, retrieve the whole object in readable format.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.