cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
asAdmin
Level: Powered On

How to get the numbered iteration in an Apply To Each function?

I have a flow that when a sharepoint list item is created, it gets the attachments from that list item, loops over them using Apply To Each, and for each one, creates a file in a sharepoint document library. This works great, except when I get to naming the files. I can do this successfully with a static file name or a dynamic name from the list item but I am trying to name them dynamically, so that each iteration adds that number iteration to the file name. For example, if I had 3 attachments, it would name the files:

 

'Picture 1'

'Picture 2'

'Picture 3'

 

I am having trouble figuring out how to capture which iteration the Apply To Each is on, in order to append it to the file name. It either needs to keep a count during the iteration or it needs to know the total amount of attachments before the Apply To Each so I can try to attach the number that way? Any thoughts on best way to know the current iteration or a way to count through the iterations?

1 ACCEPTED SOLUTION

Accepted Solutions
asAdmin
Level: Powered On

Re: How to get the numbered iteration in an Apply To Each function?

Nevermind I figured it out. You can initialize a variable outside of the Apply to Each, then use the Increment Variable inside the Apply To Each to increment it through each iteration. Then you can set that variable into the file name.Screen Shot 2018-10-10 at 7.27.07 AM.png

View solution in original post

2 REPLIES 2
asAdmin
Level: Powered On

Re: How to get the numbered iteration in an Apply To Each function?

Nevermind I figured it out. You can initialize a variable outside of the Apply to Each, then use the Increment Variable inside the Apply To Each to increment it through each iteration. Then you can set that variable into the file name.Screen Shot 2018-10-10 at 7.27.07 AM.png

View solution in original post

domVitu
Level: Powered On

Re: How to get the numbered iteration in an Apply To Each function?

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Users online (6,323)