Example: Using array-iterate

A simple example showing the basic usageof the array-iterate node from node-red-contrib-primitives

[{"id":"632329db.9cdcd8","type":"inject","z":"39731b9a.c68ce4","name":"Start Array Examples","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":152,"y":208,"wires":[["3ad86a65.c52796"]]},{"id":"3ad86a65.c52796","type":"function","z":"39731b9a.c68ce4","name":"CreateArrayPayload","func":"msg.payload = [\n    {\n        id:1,\n        name: \"Item 1\"\n    },\n    {\n        id:2,\n        name: \"Item 2\"\n    }\n];\nreturn msg;","outputs":1,"noerr":0,"x":382,"y":208,"wires":[["74168b09.8be974"]]},{"id":"74168b09.8be974","type":"array-iterate","z":"39731b9a.c68ce4","name":"ProcessNextItem","x":640,"y":208,"wires":[["84670aab.7b98f8"],["51d6becb.ae294"]]},{"id":"f5a452b5.0a5bb","type":"debug","z":"39731b9a.c68ce4","name":"","active":true,"console":"false","complete":"payload","x":1047,"y":190,"wires":[]},{"id":"84670aab.7b98f8","type":"template","z":"39731b9a.c68ce4","name":"Format ID and Name","field":"payload","format":"handlebars","template":"{{payload.id}} - {{payload.name}}","x":663,"y":62,"wires":[["f5a452b5.0a5bb","74168b09.8be974"]]},{"id":"51d6becb.ae294","type":"template","z":"39731b9a.c68ce4","name":"All Items Complete","field":"payload","format":"handlebars","template":"All Items have been processed.","x":650,"y":296,"wires":[["f5a452b5.0a5bb"]]}]
chromecide

Flow Info

created 1 year, 5 months ago

Node Types

Core
  • debug (x1)
  • function (x1)
  • inject (x1)
  • template (x2)
Other

Tags

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