cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tludwig
Advocate I
Advocate I

Increment a variable each time an automated flow is run

I'm making a flow that saves each new email attachment that comes into a shared mailbox by a new name in sharepoint that includes a number that increases by 1 each time a new file is created. I'm looking for a suggestion on how to do this. I was originally going to get a number from a cell in an excel table, add it to the file name, and then increment it up one and update the excel cell with the new number but I can't figure out how to do that. Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

@tludwig 

See my example below.  You can refer to the variable when renaming the file.  I could have made this a bit more elegant with the use of expressions, but I tried to keep it as simple as possible.

OneUp1.jpgOneUp2.jpgOneUp3.jpg

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

4 REPLIES 4
ScottShearer
Super User III
Super User III

@tludwig 

There are a few ways to go about this.  Since you're already using SharePoint, why not just create a custom SharePoint list.  Add a number column to the list - call it something like NextNumber.  The list will only have one row of data.  Use a SharePoint Get Items action to retrieve that row and the number.  Then, update the SharePoint list incrementing the number by 1.  Using a SharePoint list will allow you to avoid issues that sometimes take place when updating Excel files.

As I said, there are a number of ways to go about this...

If you need an example, please let me know.

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

Thanks @ScottShearer 

 

Could you provide an example? I am having trouble capturing the number in the list as a dynamic value so I can initialize a variable.

@tludwig 

See my example below.  You can refer to the variable when renaming the file.  I could have made this a bit more elegant with the use of expressions, but I tried to keep it as simple as possible.

OneUp1.jpgOneUp2.jpgOneUp3.jpg

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

Perfect Thanks 🙂

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (3,415)