Msg conversion issues

Good evening

I have a function node that manipulates text and outputs in the following variables.

var out = {payload: [i] + StrIO[i] + Temp[i] };
node.send({payload:out});

I am trying to feed this value into a change node but I have noticed using a debug node that it shows it as payload object not payload string which means the change node does not work.
If I feed my value into the change node using an inject node it works.

So I guess I need to convert the msg object value to a string

Many thanks In anticipation

regards
Andrew

You’ve stacked your payload inside another payload. Maybe just return out ?

As i is a number it will try to do arithmetic addition instead of string. Convert i to a string before concatenating them. Or even better use string interpolation.

Dceejay
Many thanks for your reply unfortunately I do not understand your response, please accept my ignorance on this matter

You have created an object called out that contains a property called payload. Then in the node.send() call you create another object containing a property called payload which itself contains the out object.
The result is that when you receive that message in the next node msg.payload contains your out object.
Possibly what you meant was
node.send(out)

Hi Colin

Many thanks for helping me out, I really struggle with the msg part of node red and have tried reading the documents on it maybe I am to old lol.

Again thank you it worked like a dream and thank you to the forum.

Regards

Andrew

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