Hi all,
I'm going crazy with loops. I'm trying to implement nested loops into a recursive API requests system.
I can't find a solution. Can anyone could help me ?
Thanks a lot.
.Christian
I create something simple to understand how to do that...
[{"id":"7f5f20d.d5e58e","type":"array-loop","z":"9c2df3b0.58155","name":"array-loop","key":"al1a60a19a718526","keyType":"msg","reset":false,"resetValue":"value-null","array":"array","arrayType":"msg","x":1200,"y":1520,"wires":[["971350a4.6ab3f"],["724715e9.b3f0ac"]]},{"id":"c2e623b7.ffaef","type":"inject","z":"9c2df3b0.58155","name":"msg.payload = \"A, B, C, D, E\"","props":[{"p":"payload","v":"A, B, C, D, E","vt":"str"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"A, B, C, D, E","payloadType":"str","x":720,"y":1520,"wires":[["b9ea69d8.8475b8"]]},{"id":"971350a4.6ab3f","type":"debug","z":"9c2df3b0.58155","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1370,"y":1520,"wires":[]},{"id":"b9ea69d8.8475b8","type":"change","z":"9c2df3b0.58155","name":"split msg.payload by \", \"","rules":[{"t":"set","p":"array","pt":"msg","to":"$split(msg.payload, ', ')","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":980,"y":1520,"wires":[["7f5f20d.d5e58e"]]},{"id":"a7237b14.0d86f8","type":"function","z":"9c2df3b0.58155","name":"return msg","func":"\nreturn msg;","outputs":1,"noerr":0,"x":1140,"y":1605,"wires":[["21f7367f.5a60ba","5206cc04.1b85d4"]]},{"id":"21f7367f.5a60ba","type":"debug","z":"9c2df3b0.58155","name":"Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1535,"y":1595,"wires":[]},{"id":"724715e9.b3f0ac","type":"delay","z":"9c2df3b0.58155","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":980,"y":1605,"wires":[["a7237b14.0d86f8"]]},{"id":"5206cc04.1b85d4","type":"function","z":"9c2df3b0.58155","name":"new loop","func":"msg.test = \"1, 2, 3, 4, 5\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":920,"y":1710,"wires":[["11a73a64.bc4036"]]},{"id":"11a73a64.bc4036","type":"change","z":"9c2df3b0.58155","name":"split msg.payload by \", \"","rules":[{"t":"set","p":"array","pt":"msg","to":"$split(msg.test, ', ')","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1130,"y":1710,"wires":[["19b946d4.6576b9"]]},{"id":"4d63e81e.371b68","type":"delay","z":"9c2df3b0.58155","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1320,"y":1805,"wires":[["3d650ec4.068082"]]},{"id":"3d650ec4.068082","type":"function","z":"9c2df3b0.58155","name":"return msg","func":"\nreturn msg;","outputs":1,"noerr":0,"x":1480,"y":1805,"wires":[["19b946d4.6576b9","3a1722e7.88860e"]]},{"id":"19b946d4.6576b9","type":"array-loop","z":"9c2df3b0.58155","name":"","key":"al8d749521bb8678","keyType":"msg","reset":false,"resetValue":"value-null","array":"array","arrayType":"msg","x":1380,"y":1690,"wires":[["1cf24671.3f45ca","7f5f20d.d5e58e"],["4d63e81e.371b68"]]},{"id":"1cf24671.3f45ca","type":"debug","z":"9c2df3b0.58155","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1590,"y":1685,"wires":[]},{"id":"55840ea2.48953","type":"inject","z":"9c2df3b0.58155","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":670,"y":1705,"wires":[["5206cc04.1b85d4"]]},{"id":"3a1722e7.88860e","type":"debug","z":"9c2df3b0.58155","name":"Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1690,"y":1805,"wires":[]}]