# Save data from each iteration of a loop

**URL:** <https://community.postman.com/t/save-data-from-each-iteration-of-a-loop/62348>\
**Category:** Help Hub\
**Tags:** postman-flows\
**Created:** [June 18, 2024, 1:33pm UTC](https://community.postman.com/t/save-data-from-each-iteration-of-a-loop/62348 "2024-06-18T13:33:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![craigdavieslumin](https://avatars.discourse-cdn.com/v4/letter/c/cab0a1/32.png) [@craigdavieslumin](https://community.postman.com/u/craigdavieslumin)\
**Post date:** [June 18, 2024, 1:33pm UTC](https://community.postman.com/t/save-data-from-each-iteration-of-a-loop/62348/1 "2024-06-18T13:33:43Z")

</div>

Hi!  
I’m running a loop over a number of requests and would like to store the id from each iteration, once this has been completed I want these id’s to be passed into a different loop.

I’ve tried a few different approaches but can only get the output of one iteration. Below is where I’m at currently, thanks in advance for any help with this!!

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/e/1/e1df4cb862ca14cd712149f88bd2d82b7690eb62.png)

---

<div class="post-metadata">

**Author:** ![flows-daniel](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/flows-daniel/32/25516_2.png) [@flows-daniel](https://community.postman.com/u/flows-daniel)\
**Post date:** [June 18, 2024, 3:40pm UTC](https://community.postman.com/t/save-data-from-each-iteration-of-a-loop/62348/2 "2024-06-18T15:40:18Z")

</div>

Hey @craigdavieslumin

Welcome to the forums!

It looks like the issue is your variables in your Sed Request block aren’t pinned. Press the pin icon on both of them and your loop should work.

By default, variables only trigger once but for loops, pinning them allows them to trigger each iteration.

---

<div class="post-metadata">

**Author:** ![craigdavieslumin](https://avatars.discourse-cdn.com/v4/letter/c/cab0a1/32.png) [@craigdavieslumin](https://community.postman.com/u/craigdavieslumin)\
**Post date:** [June 18, 2024, 7:49pm UTC](https://community.postman.com/t/save-data-from-each-iteration-of-a-loop/62348/3 "2024-06-18T19:49:12Z")

</div>

Hey @flows-daniel!

That’s perfect, thanks for the assist 👍

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [June 21, 2024, 7:50pm UTC](https://community.postman.com/t/save-data-from-each-iteration-of-a-loop/62348/4 "2024-06-21T19:50:01Z")

</div>

Closed on June 21, 2024, 7:50pm UTC

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