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!
@Charles-v-D, one thing you can do is up at the top of your flow to initialize a string variable:
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:
The outpu of the union will look something like mine here:
But once each item has gone into the string variable the result of that will look like this (with the first 2 items shown):
You can then do whatever actions are needed on each one.
I hope that helps you get closer to what you need.
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.
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.
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:
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.
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!
Look out for new contribution recognition badges coming SOON!
Join us for the first ever Power Platform Online Conference!
We've updated and improved the layout and uploading format of the Power Automate Cookbook!
Fill out a quick form to claim your user group badge now!
Learn how to build the business apps that you need.
Find out where you can attend!
Watch & learn from the Power Automate Community Video Gallery!