cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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

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

Highlighted
domVitu
Level: Powered On

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

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Users Online
Currently online: 302 members 5,278 guests
Please welcome our newest community members: