tim26
2 April 2022 21:49
1
Hey,
i please need help with a function node.
From a sql query i get an array with a variable number of objects.
Example:
Now i need to send this data via a telnet connection to my device as follows:
1010000021325-020|1090000021219-025C|.....
Can please anybody help me with the function node to realize this?
Thanks in advance
Tim
E1cid
2 April 2022 22:10
2
Try
msg.payload = msg.payload.map(v => Object.values(v).join("")).join("|");
return msg;
1 Like
Something like this might get you close:
msg.payload = Object.entries(msg.payload);
let result = "";
for (let i = 0; i < msg.payload.length; i++) {
result += msg.payload[i][1];
};
msg.payload = result;
return msg;
tim26
3 April 2022 10:21
4
Thank to both of you!
This works well for me.
Thank you for your help!
system
Closed
2 June 2022 10:22
5
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.