cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Increment variable - Test mode v practical one

Hello,

 

I have a question regarding an incremental variable I implemented in my flow.

 

I tested it and the value shows what I'm asking, i.e. 1, as this is the first one. If I run a test again, it still shows 1 for the newly created item.

iamlaszlo_0-1608470009415.png

iamlaszlo_1-1608470254905.png

 

 

Now, my question is : if I run it live, when people will create new items, will that incremental turn into increment+1 (so 2,3,etc..)

 

Does somebody know about this ? or maybe tell me what I need to implement in order to run it properly ?

 

Thanks a lot in advance.

 

KR,

Laszlo

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Dual Super User II
Dual Super User II

Hi @iamlaszlo 

 

The increment variable action is valid for the particular run only. So if the flow was triggered and the variable was incremented, it will reset when the flow is triggered again and start from the value that is initialized in the variable. 

 

If you want to track the number that way, maybe you can add a column to the SP list and update when a new item is created or use the ID of the SharePoint item on which the flow is being triggered. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Hello @iamlaszlo ,

you can either create the list again (it'll start assigning IDs again starting from 1) or do a calculation when initializing the variable. I personally would create a copy of the existing list, then delete the old list and redirect the flow to the new one.

But if you want to continue in the current list, instead of using the ID directly in the value initialization, use calculation ID - 22 (? or other number to get number 1 with the first workflow run). There's add() expression for that.

add([ID],-22)

Note:
[ID] is the dynamic content

 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ ... and if you like my response, you might like also the tips and solutions on my Power Automate related blog ]

View solution in original post

8 REPLIES 8
Dual Super User II
Dual Super User II

Hi @iamlaszlo 

 

The increment variable action is valid for the particular run only. So if the flow was triggered and the variable was incremented, it will reset when the flow is triggered again and start from the value that is initialized in the variable. 

 

If you want to track the number that way, maybe you can add a column to the SP list and update when a new item is created or use the ID of the SharePoint item on which the flow is being triggered. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Super User II
Super User II

Hello @iamlaszlo ,

if you set the variable to 0 at the beginning of the flow and then increment it by 1, it'll be always 1 for each flow you start. Every new instance of the flow will go step by step through the flow.

If the whole meaning of the incrementing variable is to increase it by 1 for each new item, then you can use the item ID directly which is automatically incremented by 1 for each new item.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ ... and if you like my response, you might like also the tips and solutions on my Power Automate related blog ]
Frequent Visitor

Hello,


Thank you both !

 

My sharepoint list looks like that.

iamlaszlo_0-1608474274511.png

 

''If the whole meaning of the incrementing variable is to increase it by 1 for each new item, then you can use the item ID directly which is automatically incremented by 1 for each new item.''

- How could I do that ? Wouldnt it be the same as what I tried to do above ?

 

''If you want to track the number that way, maybe you can add a column to the SP list and update when a new item is created or use the ID of the SharePoint item on which the flow is being triggered. ''

- Same here, I would add a column, but how do my flow would look like ? Do I change the value ?

 

Thanks in advance 🙂

 

Hi @iamlaszlo 

 

The item ID is always generated fresh incremented by one number from the previously created SharePoint item and so will be different from the increment variable action which is always going to be  1 as you are incrementing it from 0. 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Frequent Visitor

Hello,

 

I do understand what you mean, I'm just afraid I dont know how I should implement it, or where ?


Thanks for your patience and looking fwd to hearing from you.

Frequent Visitor

Alright, everything works like a charm.

 

I understood what you mean and updated accordingly.

 

Now, my test phase is over, so I deleted every data, and just did a test, problem is that I can see that it's continuing (in my case giving me 22, I did 21 test before)

iamlaszlo_0-1608486349358.png

iamlaszlo_1-1608486364358.png

 

Any way I can reset the counter ?

 

Thanks in advance

 

Hello @iamlaszlo ,

you can either create the list again (it'll start assigning IDs again starting from 1) or do a calculation when initializing the variable. I personally would create a copy of the existing list, then delete the old list and redirect the flow to the new one.

But if you want to continue in the current list, instead of using the ID directly in the value initialization, use calculation ID - 22 (? or other number to get number 1 with the first workflow run). There's add() expression for that.

add([ID],-22)

Note:
[ID] is the dynamic content

 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ ... and if you like my response, you might like also the tips and solutions on my Power Automate related blog ]

View solution in original post

Frequent Visitor

Great ! I will go for the second solution, all of my lists are already setup in Teams, if I can use something that wont change everything, I guess it's preferable.

 

Thanks a lot to you both !

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (12,740)