cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Bapt_69
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
v-bacao-msft
Community Support
Community Support

 

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.

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.

 

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.

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.

 

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.

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

 

 

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.

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...

 

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
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

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.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Users online (3,517)