cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Charles-v-D
Level: Powered On

Stepping through an self build array

Hi All,

I have 2 share-point lists. I need to analyse the items in both. so I do two "get items" and then a union expression to combine the two into a single array.

Now I'm going to step through this array using the "apply to each" action... I select the array as the source. When I test I see that it makes the correct amount of passes to go through the array...

 

No I want to set actions within the "apply to each", but when I want to use info from my array I only see the array-name, I can't select any of the "fields" within. I think I need something with compose... but I'm real novice with stepping through an array...

 

any basic education on how to step through an array and for example set an variable based on a array element would be really appreciated!

 

Regards

charles

 

4 REPLIES 4
Super User
Super User

Re: Stepping through an self build array

@Charles-v-D, one thing you can do is up at the top of your flow to initialize a string variable:

0-initStringVariable.png

Next, after the Union add an apply to each. Use the output of the Compose with the union in it, select your string variable then in the value field select Current item from the dynamic content:

1-Append.png

The outpu of the union will look something like mine here:

2-resultUnion.png

But once each item has gone into the string variable the result of that will look like this (with the first 2 items shown):

3-resultStringVariable.png

You can then do whatever actions are needed on each one.

I hope that helps you get closer to what you need.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

 

Charles-v-D
Level: Powered On

Re: Stepping through an self build array

Thanks @RobElliott , but in your example how would I get hold of Rey, Chorley etc.. so a specific field in each of the CurrentItems?

 

regards

Charles

 

Super User
Super User

Re: Stepping through an self build array

My reply shows you that. Each item in the union is put into a separate string variable. For further actions below that in your flow you would select the string variable and it would use the value for that item (remember it's inside an apply to each). You don't select the actual value of the item unless for example you want to use a condition, you select the variable and it puts in the appropriate value.

Rob
Los Gallardos

Dual Super User
Dual Super User

Re: Stepping through an self build array

Hi @Charles-v-D 

 

Based on the explanation you provided, the union will create an array of objects and you will have to access individual items using the key for that specific value. For example: 

 

 

ddw.PNG

Here, I have an array with name and place and in the loop i am iterating over each array item to get the name from that particular item. 

Expression: 

items('Apply_to_each')?['Name']

This gets the name key from the current item in the array. Similarly you can use the SP column names to get those values. 

 

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!

Helpful resources

Announcements
firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

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!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Users online (6,044)