# Perform actions on the basis of iteration count in Collection Runner

**URL:** <https://community.postman.com/t/perform-actions-on-the-basis-of-iteration-count-in-collection-runner/2739>\
**Category:** Help Hub\
**Tags:** csvdatafile\
**Created:** [September 20, 2018, 3:13pm UTC](https://community.postman.com/t/perform-actions-on-the-basis-of-iteration-count-in-collection-runner/2739 "2018-09-20T15:13:34Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![singhsivcan](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/singhsivcan/32/1595_2.png) [@singhsivcan](https://community.postman.com/u/singhsivcan)\
**Post date:** [September 20, 2018, 3:35pm UTC](https://community.postman.com/t/perform-actions-on-the-basis-of-iteration-count-in-collection-runner/2739/2 "2018-09-20T15:35:52Z")

</div>

Hey @gherghinoiu, the good news is that it’s solvable!

So, if you scroll down the docs - [https://www.getpostman.com/docs/v6/postman/scripts/postman\_sandbox\_api\_reference](https://www.getpostman.com/docs/v6/postman/scripts/postman_sandbox_api_reference)

You’ll see that in the `pm.info` object, there’s a property called as `iterationCount` which is the total number of iterations that are scheduled to run.

Now,  
Total number of iterations === Number of rows in your CSV File

Also, instead of using the `response_array.length` you can use another property of the `pm.info` object viz. `pm.info.iteration` which gives you the current iteration number.

So, to sum it up:

In your test-script you can put the following code snippet:

```javascript
// Since, pm.info.iteration starts from 0
// Thus, we'll check if iteration === iterationCount - 1
if (pm.info.iteration === pm.info.iterationCount - 1) {
    console.log(`response_times are: ${pm.globals.get('response_times')}`);
}

```

---

_[View the full topic](https://community.postman.com/t/perform-actions-on-the-basis-of-iteration-count-in-collection-runner/2739)._
