cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Variable with each for loop

Hi everyone,

I wrote something on this post (solved) :

https://powerusers.microsoft.com/t5/General-Flow-Discussion/Using-apply-to-each-create-HTML-table-an...

I create again a new post with my problem.

 

I want to create an array for each provider (with orders). Then, I send an email with it.

I initialize the variable (type=array) then I start a loop "each for". I append the array variable then, the mail is sending.

But.....when the loop "restart", the initialisation is not setting! So the array become bigger and bigger...

 

here is my Flow :

screen1.png

 

Apply2 details :

screen2.png

 

Thanx for all,

Baptiste

9 REPLIES 9
Highlighted
Community Support
Community Support

Re: Variable with each for loop

 

Hi @Bapt_69 ,

 

You could add Set variable action below Create HTML table action to empty the current array.

Like:

30.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper I
Helper I

Re: Variable with each for loop

lol

I already tried...

 

Not working cause the "set variable" action is not available in a loop. You are able to set it only out of every loop.

Highlighted
Community Support
Community Support

Re: Variable with each for loop

 

Hi @Bapt_69 ,

 

 

31.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper I
Helper I

Re: Variable with each for loop

Sorry,

I'm confusing between "set" and "intialize" 😉

"Set" is ok. Thank you.

 

I guess "[]" means you make the variable empty? Cause you have to fill the field.

Highlighted
Community Support
Community Support

Re: Variable with each for loop

 

Yep.

 

 

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper I
Helper I

Re: Variable with each for loop

Something wrong...sorry... 😞

 

My variable stay empty...even after the loop, after appending values.

 

Take a look on my flow :

 

Blabla1.png

 

Take a look on the "apply 2" details :

Blabla2.png

 

Highlighted
Community Support
Community Support

Re: Variable with each for loop

 

Hi @Bapt_69 ,

 

You could add Set variable action below Create HTML table action to empty the current array.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper I
Helper I

Re: Variable with each for loop

Ok I put "create the HTML table" right before "Set variable" (at the start of my loop) and the issue is the same...

My table is empty...

Highlighted
Community Support
Community Support

Re: Variable with each for loop

 

Hi @Bapt_69 ,

 

Please try to observe the execution result of each action in Flow run history, whether it is in line with expectations.

For example, check whether there is value in Append to array variable action, or it is only null value every time. Your current configuration is no problem. It seems that data that is not in accordance with expectations is filtered out and appended to the array variable.

Or you could try to configure Set variable action to the last step of Apply to each 3.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (9,913)