1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

node-red、msg.payloadの値を後で使いたい場合のやり方

Posted at

#背景
node-redで、フローの最初の方で取得したmsg.payloadを後で使いたいケースがよくある。
msg.payloadとかmsg.payload.xxxとかmsgの下に格納するとフローの途中で消えるので困った。

#対応
global.xxxとかflow.xxxを使う。

node-red_sample

//flowへ格納
flow.set("user_name",msg.payload.user_name);

//flowから取り出す。同じフロー内だったら、どこからでも呼べる
var user_name = flow.get("user_name");

//flow.user_nameって使い方はできないらしい

######参考

Node-RED日本ユーザ会 : Functionノードの書き方

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?