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

Referencing outputs from Loop-A to Loop-B?

Hi,

How do I pass  value generated from an "Apply to each" loop and to refer it in another loop, or just to use outside of the loop?

Thank you.

6 REPLIES 6
Highlighted
Dual Super User
Dual Super User

Re: Referencing outputs from Loop-A to Loop-B?

If its a value generated during each loop then there is no easy way to do it.  If its something like a total or an aggregation of the content in the loop then you can save that in a Variable to use in another loop.  If you need the output of a single loop then you should embed Loop B inside Loop A.  The current value of Loop A will be available in Loop B.



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

Re: Referencing outputs from Loop-A to Loop-B?

Hi @si2019 ,

 

You could provide more details of your needs.

Basically we could reference the specified value through variables and Dynamic content that can be used in nested loops.

Or you could use expression to reference a specified value based on a specific property.

We need more details about specific need to provide more detailed instructions.

 

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
Regular Visitor

Re: Referencing outputs from Loop-A to Loop-B?

Thanks for your fast response, sir.

 

I tried nesting loop but it required output from Loop A as an Array variable in order for Loop B to process. How do I do that?

* I'm a newbie explorering my first MS Flow.

 

Thanks, again.

Highlighted
Regular Visitor

Re: Referencing outputs from Loop-A to Loop-B?

@v-bacao-msft, what expression do I use to referencing a loop value as an Array variable from outside of it?

 

Thank you.

Highlighted
Dual Super User
Dual Super User

Re: Referencing outputs from Loop-A to Loop-B?

The loop doesn't automatically create an Array variable.  But if you initialize an Array variable before entering the loop then there is an action where you can append to array variable inside the body of Loop A.  That will produce the array you need for Loop B.



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

Re: Referencing outputs from Loop-A to Loop-B?

@Pstork1, Append to Array Variable inside Loop A did not give me the Dynamic content to select its output.

Below is the Flow I'm trying to do. Basically, a Flow to automatically add/remove mebers from a Teams based on a CSV file from OneDrive.

Thanks again for your advises.

FlowTest.jpg

Helpful resources

Announcements
firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Users online (8,075)