Injecting many payloads at once (node-red)Node-red - writing conditional functionConcurrent access to msg/payload on split flows in node-red?Get value from msg.payload return from a mysql query Node-REDNode-Red: Parsing JSON data and converting it into binary.update a file in node-red through context-storageNode Red Wemo Lookup JSON parsing error msg.payload : undefinedGetting individual data from node-red Object?Error “TypeError: Cannot read property 'ODP' of undefined” on node-rednode-red Schedex nodeNode-Red Function Wait for 2 Inputs
How can I use my cell phone's light as a reading light?
Tesco's Burger Relish Best Before End date number
Why do people prefer metropolitan areas, considering monsters and villains?
Will Jimmy fall off his platform?
Why SQL does not use the indexed view?
Was the 45.9°C temperature in France in June 2019 the highest ever recorded in France?
What does the multimeter dial do internally?
Why no parachutes in the Orion AA2 abort test?
I don't want to be introduced as a "Minority Novelist"
How do I talk to my wife about unrealistic expectations?
How to say "is going" in Russian in "this game is going to perish"
How was the website able to tell my credit card was wrong before it processed it?
Why am I getting unevenly-spread results when using $RANDOM?
When do flights get cancelled due to fog?
What was the nature of the known bugs in the Space Shuttle software?
How to understand flavors and when to use combination of them?
Why did Robert F. Kennedy loathe Lyndon B. Johnson?
What are the consequences for a developed nation to not accept any refugee?
Array or vector? Two dimensional array or matrix?
Intern not wearing safety equipment; how could I have handled this differently?
What exactly is a "murder hobo"?
Can a USB hub be used to access a drive from two devices?
Did William Shakespeare hide things in his writings?
Alice's First Code Review
Injecting many payloads at once (node-red)
Node-red - writing conditional functionConcurrent access to msg/payload on split flows in node-red?Get value from msg.payload return from a mysql query Node-REDNode-Red: Parsing JSON data and converting it into binary.update a file in node-red through context-storageNode Red Wemo Lookup JSON parsing error msg.payload : undefinedGetting individual data from node-red Object?Error “TypeError: Cannot read property 'ODP' of undefined” on node-rednode-red Schedex nodeNode-Red Function Wait for 2 Inputs
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have a problem. I'm new to node red, I want to inject many payloads with different topics at once. I wanted to do it with function like in first node. It's function looks like so:
msg.topic="ns=2;s=Target01.Nazwa.Nazwa[0];datatype=String"
msg.payload=global.get("nazwa")
return msg
msg.topic="ns=2;s=Target01.Nazwa.Nazwa[1];datatype=String"
msg.payload=global.get("nazwa2")
return msg
...
msg.topic="ns=2;s=Target01.Nazwa.Nazwa[9];datatype=String"
msg.payload=global.get("nazwa9")
return msg
However it doesn't work. The 2nd node is working but in total I would have like 150+ blocks connected to OPC UA Client block. So my question is: does anyone know if there's a way to inject multiple payloads with different topics, favorabily with function, instead of doing it one by one with inject blocks?
node.js node-red
add a comment |
I have a problem. I'm new to node red, I want to inject many payloads with different topics at once. I wanted to do it with function like in first node. It's function looks like so:
msg.topic="ns=2;s=Target01.Nazwa.Nazwa[0];datatype=String"
msg.payload=global.get("nazwa")
return msg
msg.topic="ns=2;s=Target01.Nazwa.Nazwa[1];datatype=String"
msg.payload=global.get("nazwa2")
return msg
...
msg.topic="ns=2;s=Target01.Nazwa.Nazwa[9];datatype=String"
msg.payload=global.get("nazwa9")
return msg
However it doesn't work. The 2nd node is working but in total I would have like 150+ blocks connected to OPC UA Client block. So my question is: does anyone know if there's a way to inject multiple payloads with different topics, favorabily with function, instead of doing it one by one with inject blocks?
node.js node-red
add a comment |
I have a problem. I'm new to node red, I want to inject many payloads with different topics at once. I wanted to do it with function like in first node. It's function looks like so:
msg.topic="ns=2;s=Target01.Nazwa.Nazwa[0];datatype=String"
msg.payload=global.get("nazwa")
return msg
msg.topic="ns=2;s=Target01.Nazwa.Nazwa[1];datatype=String"
msg.payload=global.get("nazwa2")
return msg
...
msg.topic="ns=2;s=Target01.Nazwa.Nazwa[9];datatype=String"
msg.payload=global.get("nazwa9")
return msg
However it doesn't work. The 2nd node is working but in total I would have like 150+ blocks connected to OPC UA Client block. So my question is: does anyone know if there's a way to inject multiple payloads with different topics, favorabily with function, instead of doing it one by one with inject blocks?
node.js node-red
I have a problem. I'm new to node red, I want to inject many payloads with different topics at once. I wanted to do it with function like in first node. It's function looks like so:
msg.topic="ns=2;s=Target01.Nazwa.Nazwa[0];datatype=String"
msg.payload=global.get("nazwa")
return msg
msg.topic="ns=2;s=Target01.Nazwa.Nazwa[1];datatype=String"
msg.payload=global.get("nazwa2")
return msg
...
msg.topic="ns=2;s=Target01.Nazwa.Nazwa[9];datatype=String"
msg.payload=global.get("nazwa9")
return msg
However it doesn't work. The 2nd node is working but in total I would have like 150+ blocks connected to OPC UA Client block. So my question is: does anyone know if there's a way to inject multiple payloads with different topics, favorabily with function, instead of doing it one by one with inject blocks?
node.js node-red
node.js node-red
asked Mar 25 at 21:26
adammoadammo
237 bronze badges
237 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The documentation explains how to send multiple messages from a status node.
With the code you have currently, as soon as it reaches the first return
statement, the Function node stops processing any further so only one message is sent.
To send multiple messages from a Function node you have two options.
- return an array of message objects to send.
- call
node.send(msg);
for each message you want to send.
For example:
return [
[
topic: "ns=2;s=Target01.Nazwa.Nazwa[0];datatype=String", payload: global.get("nazwa"),
topic: "ns=2;s=Target01.Nazwa.Nazwa[1];datatype=String", payload: global.get("nazwa2"),
topic: "ns=2;s=Target01.Nazwa.Nazwa[9];datatype=String", payload: global.get("nazwa9")
]
]
Thanks, worked like a charm
– adammo
Mar 25 at 22:08
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55346643%2finjecting-many-payloads-at-once-node-red%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The documentation explains how to send multiple messages from a status node.
With the code you have currently, as soon as it reaches the first return
statement, the Function node stops processing any further so only one message is sent.
To send multiple messages from a Function node you have two options.
- return an array of message objects to send.
- call
node.send(msg);
for each message you want to send.
For example:
return [
[
topic: "ns=2;s=Target01.Nazwa.Nazwa[0];datatype=String", payload: global.get("nazwa"),
topic: "ns=2;s=Target01.Nazwa.Nazwa[1];datatype=String", payload: global.get("nazwa2"),
topic: "ns=2;s=Target01.Nazwa.Nazwa[9];datatype=String", payload: global.get("nazwa9")
]
]
Thanks, worked like a charm
– adammo
Mar 25 at 22:08
add a comment |
The documentation explains how to send multiple messages from a status node.
With the code you have currently, as soon as it reaches the first return
statement, the Function node stops processing any further so only one message is sent.
To send multiple messages from a Function node you have two options.
- return an array of message objects to send.
- call
node.send(msg);
for each message you want to send.
For example:
return [
[
topic: "ns=2;s=Target01.Nazwa.Nazwa[0];datatype=String", payload: global.get("nazwa"),
topic: "ns=2;s=Target01.Nazwa.Nazwa[1];datatype=String", payload: global.get("nazwa2"),
topic: "ns=2;s=Target01.Nazwa.Nazwa[9];datatype=String", payload: global.get("nazwa9")
]
]
Thanks, worked like a charm
– adammo
Mar 25 at 22:08
add a comment |
The documentation explains how to send multiple messages from a status node.
With the code you have currently, as soon as it reaches the first return
statement, the Function node stops processing any further so only one message is sent.
To send multiple messages from a Function node you have two options.
- return an array of message objects to send.
- call
node.send(msg);
for each message you want to send.
For example:
return [
[
topic: "ns=2;s=Target01.Nazwa.Nazwa[0];datatype=String", payload: global.get("nazwa"),
topic: "ns=2;s=Target01.Nazwa.Nazwa[1];datatype=String", payload: global.get("nazwa2"),
topic: "ns=2;s=Target01.Nazwa.Nazwa[9];datatype=String", payload: global.get("nazwa9")
]
]
The documentation explains how to send multiple messages from a status node.
With the code you have currently, as soon as it reaches the first return
statement, the Function node stops processing any further so only one message is sent.
To send multiple messages from a Function node you have two options.
- return an array of message objects to send.
- call
node.send(msg);
for each message you want to send.
For example:
return [
[
topic: "ns=2;s=Target01.Nazwa.Nazwa[0];datatype=String", payload: global.get("nazwa"),
topic: "ns=2;s=Target01.Nazwa.Nazwa[1];datatype=String", payload: global.get("nazwa2"),
topic: "ns=2;s=Target01.Nazwa.Nazwa[9];datatype=String", payload: global.get("nazwa9")
]
]
answered Mar 25 at 21:37
knollearyknolleary
7,2781 gold badge16 silver badges28 bronze badges
7,2781 gold badge16 silver badges28 bronze badges
Thanks, worked like a charm
– adammo
Mar 25 at 22:08
add a comment |
Thanks, worked like a charm
– adammo
Mar 25 at 22:08
Thanks, worked like a charm
– adammo
Mar 25 at 22:08
Thanks, worked like a charm
– adammo
Mar 25 at 22:08
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55346643%2finjecting-many-payloads-at-once-node-red%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown