# Skip iteration based on value

**URL:** <https://community.postman.com/t/skip-iteration-based-on-value/14339>\
**Category:** Help Hub\
**Tags:** collections, collection-runner\
**Created:** [July 21, 2020, 6:35pm UTC](https://community.postman.com/t/skip-iteration-based-on-value/14339 "2020-07-21T18:35:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rohit](https://avatars.discourse-cdn.com/v4/letter/r/41988e/32.png) [@rohit](https://community.postman.com/u/rohit)\
**Post date:** [July 21, 2020, 6:35pm UTC](https://community.postman.com/t/skip-iteration-based-on-value/14339/1 "2020-07-21T18:35:33Z")

</div>

I am working on a postman collection where I have written two get requests for APIs. I am using a single data file in the runner for both the requests when I run. My data file looks like below -

[![enter image description here](https://us1.discourse-cdn.com/getpostman/original/3X/f/e/fef202e39d4f989a455cf31c073f21688742ae0f.png)](https://i.stack.imgur.com/QjlVC.png)

What I am trying to do is when I run request1 it should use **Algo\_id** and use in the query parameter and for request2 it should use **product\_ids**. When I run these request from the test runner using data file it runs the requests for the blank values as well, four requests each. I want to skip the runs for blank values and only run it when there is a value in the column for the request.

I want to run both the request two times and skip for the blank ones.

what I have tried so far, but had no success -

request1 Pre-request script -

[![enter image description here](https://us1.discourse-cdn.com/getpostman/original/3X/0/9/096e5a5be34b4fa100f109c22e201a793e944610.png)](https://i.stack.imgur.com/YDPwL.png)

request2 Pre-request script -

[![enter image description here](https://us1.discourse-cdn.com/getpostman/original/2X/a/af421c7872f879424fe5a8bc0c1bac4ffb259e5c.png)](https://i.stack.imgur.com/5k035.png)

---

<div class="post-metadata">

**Author:** ![Whersh](https://avatars.discourse-cdn.com/v4/letter/w/9d8465/32.png) [@Whersh](https://community.postman.com/u/Whersh)\
**Post date:** [July 22, 2020, 5:47pm UTC](https://community.postman.com/t/skip-iteration-based-on-value/14339/2 "2020-07-22T17:47:04Z")

</div>

![image](https://us1.discourse-cdn.com/getpostman/original/3X/e/a/ea91abb0c4f873507d4363189e55374878c04c8a.png)  
Each line would constitute a run of your collection. If you place the values all in the same rows the  
Run1 = request1(Algo\_id :1210) , reqquest2(product\_ids:“04372173”)  
Run2 = request1(Algo\_id :33) , reqquest2(product\_ids:“00766001”)

This would result in what you are looking to accomplish I assume. If the calls interact with each other then there might be a different solution that you would need to do.

---

<div class="post-metadata">

**Author:** ![SabriH](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@SabriH](https://community.postman.com/u/SabriH)\
**Post date:** [July 22, 2020, 7:44pm UTC](https://community.postman.com/t/skip-iteration-based-on-value/14339/3 "2020-07-22T19:44:49Z")

</div>

Hey @rohit,

Welcome to the community 👋

Two ways you could accomplish this depending on how easy you’d like it to be:

The easiest way would be to split your Collection ( or create two separate folders in a collection one for **Algo\_id** and another for **product\_ids** ) and have two different data files and run each Collection/Folder using the relevant data file separately.

Another way to accomplish this, would be to create a **third** request that acts as a Dummy request just for branching purposes ( using **setNextRequest** as you have been doing ). This dummy request would un prior to your other two requests and just be used to set the conditions you’d like.

Hope this helps provide some guidance. Let us know if you still need help!

---

<div class="post-metadata">

**Author:** ![rohit](https://avatars.discourse-cdn.com/v4/letter/r/41988e/32.png) [@rohit](https://community.postman.com/u/rohit)\
**Post date:** [July 22, 2020, 9:31pm UTC](https://community.postman.com/t/skip-iteration-based-on-value/14339/5 "2020-07-22T21:31:31Z")

</div>

thanks, I will try this. I have however implemented the logic to skip the test instead whole request as I was trying. this way I let the request run but don’t test.

---

<div class="post-metadata">

**Author:** ![rohit](https://avatars.discourse-cdn.com/v4/letter/r/41988e/32.png) [@rohit](https://community.postman.com/u/rohit)\
**Post date:** [July 22, 2020, 9:32pm UTC](https://community.postman.com/t/skip-iteration-based-on-value/14339/6 "2020-07-22T21:32:24Z")

</div>

thanks, I will give it a try. I have however moved ahead with skipping the test based on the value, this way I let the request run but don’t run the tests.
