# For each loop multiple objects in arrays

**URL:** <https://discourse.nodered.org/t/for-each-loop-multiple-objects-in-arrays/62076>\
**Category:** General\
**Created:** [2 May 2022 16:03 UTC](https://discourse.nodered.org/t/for-each-loop-multiple-objects-in-arrays/62076 "2022-05-02T16:03:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![schwartznet](https://avatars.discourse-cdn.com/v4/letter/s/f9ae1b/32.png) [@schwartznet](https://discourse.nodered.org/u/schwartznet)\
**Post date:** [2 May 2022 16:03 UTC](https://discourse.nodered.org/t/for-each-loop-multiple-objects-in-arrays/62076/1 "2022-05-02T16:03:17Z")

</div>

Hello,

I need to process a command on mac addresses i have pulled from a database but am unsure how to craft a loop in the correct manner. I need to execute a command below on each mac pulled from this query. Any help would be great.

![](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/e/1e471031dc28e7539947ec83c2b781818dbf2e5c.png)

{  
"command": "blockClient",  
"mac": "machere"  
}

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [2 May 2022 16:12 UTC](https://discourse.nodered.org/t/for-each-loop-multiple-objects-in-arrays/62076/2 "2022-05-02T16:12:15Z")

</div>

Send the array to a split node, then a change node which `SET`s `msg.payload.command` to a string of `blockClient`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [1 July 2022 16:12 UTC](https://discourse.nodered.org/t/for-each-loop-multiple-objects-in-arrays/62076/3 "2022-07-01T16:12:53Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
