# Post Looping through an Array not working

**URL:** <https://community.postman.com/t/post-looping-through-an-array-not-working/40758>\
**Category:** Help Hub\
**Created:** [November 3, 2022, 6:38pm UTC](https://community.postman.com/t/post-looping-through-an-array-not-working/40758 "2022-11-03T18:38:10Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![otrjgn](https://avatars.discourse-cdn.com/v4/letter/o/f17d59/32.png) [@otrjgn](https://community.postman.com/u/otrjgn)\
**Post date:** [November 7, 2022, 1:53pm UTC](https://community.postman.com/t/post-looping-through-an-array-not-working/40758/6 "2022-11-07T13:53:58Z")

</div>

> [@otrjgn](#):
>
> if(pkeys && pkeys.length \> 0){  
> postman.setNextRequest(“My URL Here”)
> 
> } else{  
> postman.setNextRequest(null);  
> }

This is in the “test” tab. And yes, the setNextRequest should iterate through the length of the array and post accordingly.

---

_[View the full topic](https://community.postman.com/t/post-looping-through-an-array-not-working/40758)._
