CONVERT DATABASE OBJECT IN STRING

22 views
Skip to first unread message

Nilton Cezar

unread,
Apr 25, 2017, 9:09:15 AM4/25/17
to Node-RED
Hello guys,

Using a select to query my sql server, the result is an object. But I can not use the result as a string. what am I doing wrong?

I've tried the function

msg.payload = msg.payload[0].NM_CLI;

but it does not work.


Dave C-J

unread,
Apr 25, 2017, 9:11:51 AM4/25/17
to node...@googlegroups.com
that looks like an array of two objects, each of which is also and array...]so you would need one more [0] in there...
msg.payload = msg.payload[0][0].NM_CLI

Nilton Cezar

unread,
Apr 25, 2017, 4:24:03 PM4/25/17
to Node-RED
Great Dave, it was just like that!

Thank you very much!
Reply all
Reply to author
Forward
0 new messages