How to Read Multiple Values from SQL Database

My question is similar to the 2018 post “How to Read from a SQL Database and Write to an Opto Table”, but in my case I need to know how to populate different variables in my PAC strategy.

The SQL query (which works, per the info shown in the right debug pane below) gathers various values that will serve as the setpoints in my strategy (feedrate, temperature, time, etc.).


Do I need to use (or more broadly, can I use) multiple PAC write nodes as shown above? Keep in mind, the data being queried is all different types (some 32int, some string). Also, how should I define the “time” variable in my PAC strategy? The time coming from SQL is in hours and minutes (e.g. 02:50 means 2 hrs, 50 minutes), but I can use a decimal value if PAC Control prefers that.

The way you have the nodes set up is the best and easiest way to do it, yes.
You could use a function node and the dynamic node settings to do it with just one PAC write node, but that has a heavy reliance on JavaScript – have you got any experience coding in JavaScript?

If not, no worries, just have the nodes set up like you have here and set the “value” field to be msg.payload[10].HeatTreatTemperature, for example, and then set the PAC variable you want to write to, then when you inject it should write to the three PAC nodes (or however many you need).

As far as time goes your best bet will be to use a small piece of JavaScript to convert it since PAC Control really likes things in just total seconds, but it’s a pretty trivial conversion. Do you have date information (day, month, year) or just hours and minutes?