CRUD on Global Variables

this is a simple example how to manipulate global variables

[{"id":"4ada0631.75cfe8","type":"inject","z":"72a15caa.fc0d44","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"1","payload":"","payloadType":"date","x":190,"y":120,"wires":[["69388522.79c8ac","735f562f.7aee18"]]},{"id":"69388522.79c8ac","type":"change","z":"72a15caa.fc0d44","name":"","rules":[{"t":"set","p":"user1","pt":"global","to":"{\"name\":\"Ralph\",\"ID\":152}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":100,"wires":[["b181f0b.41a7f1"]]},{"id":"735f562f.7aee18","type":"change","z":"72a15caa.fc0d44","name":"","rules":[{"t":"set","p":"user2","pt":"global","to":"{\"name\":\"Loren\",\"ID\":444}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":140,"wires":[["b181f0b.41a7f1"]]},{"id":"12b5a8e2.08b087","type":"inject","z":"72a15caa.fc0d44","name":"fetch id of user1","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"user1.ID","payloadType":"global","x":200,"y":280,"wires":[["268baab6.d433b6"]]},{"id":"c452bda5.849ca","type":"inject","z":"72a15caa.fc0d44","name":"modify id of user2","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"900","payloadType":"num","x":210,"y":380,"wires":[["9f2fb01f.afdf6"]]},{"id":"268baab6.d433b6","type":"debug","z":"72a15caa.fc0d44","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":400,"y":280,"wires":[]},{"id":"b181f0b.41a7f1","type":"debug","z":"72a15caa.fc0d44","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":620,"y":120,"wires":[]},{"id":"9f2fb01f.afdf6","type":"change","z":"72a15caa.fc0d44","name":"","rules":[{"t":"set","p":"user2.ID","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":380,"wires":[["aec58c30.77783"]]},{"id":"aec58c30.77783","type":"debug","z":"72a15caa.fc0d44","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":660,"y":380,"wires":[]},{"id":"a017dea8.446a","type":"comment","z":"72a15caa.fc0d44","name":"Set global Variable","info":"![](https://i.imgur.com/28Dx6wl.png)","x":190,"y":60,"wires":[]},{"id":"eac678a1.9c4a78","type":"comment","z":"72a15caa.fc0d44","name":"Get a Variable","info":"","x":170,"y":240,"wires":[]},{"id":"46283f8f.9ac6","type":"comment","z":"72a15caa.fc0d44","name":"Modify a Variable","info":"","x":180,"y":340,"wires":[]},{"id":"9671fc2a.74f16","type":"comment","z":"72a15caa.fc0d44","name":"Delete","info":"","x":150,"y":460,"wires":[]},{"id":"f052bc27.88ac9","type":"inject","z":"72a15caa.fc0d44","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"1","payload":"","payloadType":"date","x":190,"y":500,"wires":[["7c71029a.5cd34c"]]},{"id":"7c71029a.5cd34c","type":"change","z":"72a15caa.fc0d44","name":"","rules":[{"t":"delete","p":"user1","pt":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":500,"wires":[["35106973.321316"]]},{"id":"35106973.321316","type":"debug","z":"72a15caa.fc0d44","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":570,"y":500,"wires":[]}]

Collection Info

Flow Info

Created 4 years, 3 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x4)
  • comment (x4)
  • debug (x4)
  • inject (x4)

Tags

Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option