Power Automate Part 10 - Apply to Each loops - ID Card Make

Power Automate Part 10 - Apply to Each loops - ID Card Make Welcome to this wise out tutorial on apply to each Loops within power automate here's what you'll learn during the tutorial so we'll start by having a look at what.

Power Automate Part 10 - Apply to Each loops

The tutor remains to do and we'll get at the exercise files needed and then we'll go on to look at creating apply to each list manually something you won't often do.

Then we'll look at the more realistic alternative of creating them automatically by dropping fields in and you'll Discover at this point why power automates often creates apply to each.

Loops when you're least expecting it what we'll then do is go on to look at something of a digression which is how to copy Dynamic content into Expressions within and apply to each Loop but that's.

Very important topic we'll look at how to debug apply to each loops and finally we'll look at how to create Expressions manually by typing them in and I would encourage you if you're watching this.

Tutorial to stay to the end because that will teach you loads about how expressions are constructed in power automate but that's enough of looking at me I'm.

Going to vanish now as I tend to and let's get started so what I want to do in this part of the tutorial is show you not only the data we're going to use so you can follow.

Along but also the destination we're heading towards so you can see where we're going so in one drive what I'm going to do is create a new folder and I'll call it 10.

Applied to each because this is tutorial number 10 in the series and then we'll click on that and within this we'll upload a file so if you choose files upload.

You'll be able to find this file in the nodes attached to the tutorial on YouTube that will tell you which wise our web page to go to it's very similar to one we used earlier.

As you're about to see so if I click on that file you can see it goes into Excel 365 and shows me a list of the 10 most popular phones of all time at least at the time I created.

It anyway now despite there being a table in the underlying Excel workbook that you've just uploaded there isn't one in this so what I need to do is quickly create a.

    Table because you can't load data - ID Card Make

    Without the table from Excel so I'm going to choose insert and choose table and then choose ok and then if I go to the table design tab.

    I'll just quickly rename my table and call it films no need to save anything that happens automatically so I've now got my workbook and I can import data from it.

    So here's what the destination flow will look like this is what we're aiming to achieve we're going to start by creating a variable which will hold an array of the.

    Titles of the films made since 2000. I've just sneakily colored them to show them while you weren't looking and they should return Avatar Avengers end game and Star Wars.

    What we'll then do is load those films from Excel and then create a loop an apply to each Loop which will go through each film adding its title to the array if it was.

    Made after 2000 and then we'll show that resulting array so what I can do is actually show what this will look like when you run it if I if I execute this and what you'll see is it pauses when it.

    Gets to the apply to each Loop and shows a symbol so that orange symbol shows it's doing something and then after a few seconds it will show the resulting array and I can look.

    At that and you can see the outputs is the list of films just before we go ahead and create this I think it's worth making one point.

    This is an appallingly efficient way inefficient way to do this what I would be much better off doing is using odata as covered in the previous tutorial to add a filter so I only pick.

    Out certain rows but this is an

    Excellent way to teach you about apply it to each Loops which are pretty integral part of power ultimate so that's why I've chosen this example.

    Foreign by doing is just showing what an apply to each Loop is so I'm going to create a new flow an instant Cloud flow I'll call it looping over films showing.

    Recent ones only because that's eventually what it will do and we'll create it with a manual trigger I need to add a step and get my.

    Information from Excel and choose list rows present in the table and then go through the usual rigmarole of choosing that it's from one drive it's the OneDrive Library the file.

    Is in the folder called 10 applied to each and it's called top 10 films and the table within that if that would just get out of the way it's called films what I'm now going to do is create and.

    Apply to each Loop now this is something which is normally done automatically as I'll show you later in this tutorial but for the moment we'll apply it manually what it will do is take the value the.

    List of items from the previous step and it will Loop over them and all I'm going to do within this Loop is just use a compose statement to show what each row looks like.

    So what will my input be well it's going to be something called the current item now you'll see this appear in a number of different guises at the moment it says body value item but sometimes.

    You'll see it says current item and sometimes just item open close brackets which we'll use later so for the moment I'll choose that and if I let my mouse linger over it you can.

    See it says a reference to the items in this current task so that's set up automatically for you whenever you create and apply to each Loop to refer to each of the items in.

    Turn and that's what I'm going to do so you can now try running this and see what happens not much admittedly.

    So when you run the flow it's running now nothing much appears to have happened it was also remarkably quick I was quite surprised about that if you click on the.

    Apply to each task and have a look at the compose then what you can see is the 10 steps it went through and that's my first film Gone With the.

    Wind if I scroll up a bit and choose next I can see my next film which would be Avatar and I can use this to debug it to see what all the films were retrieved were.

    So each item is one row in the table which makes sense if you think about it so what we're now going to do is delete the apply it to each Loop that we just created and do it a more realistic way.

    Which is to create it manually so what I'm going to do is add a step and what the step will do is test a condition which is whether the film is called Titanic.

    In a bit we'll change this to say that the year we released was after 2000 which is slightly harder as we'll see so I'm going to choose a value and instead of choosing the list of items.

    I'm going to choose a single column now the moment I do this can I explain what's about to happen because I've chosen a single column it knows I need to Loop over the rows in.

    The table testing the value of each and so what it will do is create an apply to each Loop and include the condition within that and it's quite confusing when that first.

    Happens you think wow what on Earth was that if I let my mouse linger over the value you can see it's referring to the output from the table.

    And if I go to the condition and let my mouse link over title you can see it's referring to the field called title in the items the item currently being considered.

    That's how you can refer to that or one way anyway so what I want to do is test whether that's equal Titanic after much investigation which you didn't have to.

    Watch I decided you don't put inverted commas around that because it knows there's a string of text and if it does equal Titanic what I'll do is add it to my variable so I'll.

    Click here to add an action to add it to my array but I don't actually have an array at the moment so I'll just collapse that for a bit and go back up to the top and add an action to.

    Initialize an array because you can't use a variable or array unless you've initialized it I'll call it titles it's going to be an array it's going to.

    Hold a list of all the titles and I'll initialize it to an empty string what I can then do within my apply to each Loop and within my condition is if.

    I've successfully found a film which equals Titanic and let's face it there'll only be one of them I can add an action to append that to my my array so I'll choose append choose the append.

    To array variable the variable holding the titles is called titles and the thing I'm going to append is the current title so.

    That should build up an array containing all the titles and the last thing I need to do is actually display the results I'm going to add it right at the bottom another step.

    DISCLAIMER: In this description contains affiliate links, which means that if you click on one of the product links, I'll receive a small commission. This helps support the channel and allows us to continuetomake videos like this. All Content Responsibility lies with the Channel Producer. For Download, see The Author's channel. The content of this Post was transcribed from the Channel: https://www.youtube.com/watch?v=kEa27SAmkMA
Previous Post Next Post