In a function node, i can create :
msg.payload.accessToken = "Bearer "+ msg.payload.accessToken;
when i wan't to combine a string + variable.
But is there a way to do the same in a change node.
There seams to be a lot of option the the change node, but i can't quite figure out how to do this.
Yes, if you use JSONata.
to the value of
"Bearer " & payload.accessToken
Welcome to the forum!
Try this in a change node, using JSONata.
@Steve-Mcl beat me to it!
Damn you guys are fast
Thanks. That's really easy.
I think that in terms of node-red knowledge then: @Steve-Mcl > @ghayne
Sorry but i have to ask again.
Took it a bit further, but the variable does not get reconized, so the result is 2 combined strings, without the variable.
I'm setting a global variable somewhere else in my job to global.id using another change node.
in the combine job i'm trying :
"https://api.easee.cloud/api/chargers/" & global.id & "/state"
But the global.id is just empty.
Any idea on what i'm doing wrong.
And thanks in advance
You failed to mention
global.id is that a context global called id. If so it would be
Thanks. That was the error.
I had to set a $ in front, to make it work.
But it's working like this :
"https://api.easee.cloud/api/chargers/" & $globalContext("id") & "/state"
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.