Group an array operation function

Hello, I want to perform an addition operation, I have several inputs, they are DINT type numbers, but I want to group them in an array to add them, but it does not allow me, I get an error. How can I print an array?

var e1= msg.payload
var e2= msg.payload

const value = [

"value": `${e1}`


const value1 = [

"value1": `${e2}`



return [e1,e2];

msgs never travel down different the wires at the same time. Never.

So, in order to access the values of the two msgs at the same time, you need to join messages into one object.

See this article in the cookbook for an example of how to join messages into one object.

Also, you always need to return a message from a function node. So, apart from the issue identified by Steve, if you want to return an array then you must put it in the message, probably in msg.payload. So you want something like
msg.payload = [e1,e2]
return msg

Thank you very much, i try it and that was the solution.

Thank you very much, i took your recomendation too.

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