Power Automate Part 7 - Conditions - ID Card Make

Power Automate Part 7 - Conditions - ID Card Make Welcome to this wise out tutorial on testing conditions in power automate here's what you'll learn during the tutorial we'll Begin by a quick reminder of the.

Power Automate Part 7 - Conditions

Example we're working on this is the third in a three-part series of tutorials then we'll look at how you can add conditions to our flow.

How you can terminate a flow early if it fails a condition we'll test both the two paths just to check there's no magic going on and finally I'll show the switch action.

Which allows you to test between multiple cases but that's enough of looking at me I'm going to vanish and let's get started.

So for the final part of this three tutorial series we're going to look at conditions here's what we've got to so far with our example.

We're reading in the number of OneDrive files we're reading the number of SharePoint files and we arrive with some results which contains two variables there's a variable called OneDrive files.

Count which is how many files we found in the OneDrive folder and there's a variable called SharePoint recipe count which is the number of files we found in the SharePoint folder.

And what we now want to do is compare them to see whether they're equal or not if they are equal then we'll just carry on everything's hunky-dory but if they're not equal we'll send ourselves.

An email warning that there's a discrepancy and then terminate the flow so here's what this would look like we'll have a condition in saying if the number of SharePoint files equals the.

Number OneDrive files then what we'll do is carry on down the yes part of this condition and Carry On and just show some output at the end but if it isn't we'll go down the no.

Path of this condition send ourselves an email warning us what the problem is and then terminate the flow so that's what this example is going to do.

So I think adding conditions is pretty simple after I've got my results I need to test them against each other test the two variables so I'll add a new Step I'm.

    Going to look at the control actions - ID Card Make

    We're going to add a condition we'll also late in this tutorial look at switch and terminate two so I'll add a conditioning and.

    Immediately I do that it opens up not just the condition but a true path and a false path to my condition is that the SharePoint recipe count.

    Should be equal to get rid of that should be equal to the OneDrive file count and if that's true nothing will happen if it's false I'll add in an action to.

    Send an email to myself so I'm just going to choose a send email action and I'll send an email to myself and call delegate 52.

    At least during the week and my subject will be that there's a discrepancy between the different number of SharePoint and OneDrive files and as to the body of my email I've already got.

    This above my share results compose action specified how many OneDrive files and how many SharePoint files are worth that's all I really need to know so what.

    I'll do is just put the output from the show results action in and that should do so now I could try running this but just before I do that I want to add an.

    Additional Step at the bottom of the flow I'll add in a compose action it's not actually going to do anything I'm really using it for debugging to.

    Show where my flow is going to so I'll just put test in there because I need to have some inputs in so if I now try running this flow save and test.

    I'm expecting it to go down the right

    Hand path because the number of files isn't equal if I try running that and you can see from the symbols which.

    Appear where it went to it reached this condition but it never around the left hand path you can see there's no symbol to the left of it it went down the right hand.

    Path and then reached the compose action so that's worked so what I can now do is have a look at my emails so if I go into Outlook and have a look at my emails you should see I've got an email saying.

    Recipe mismatch giving the details so what I want to do now is to make sure that if the number of files isn't equal I terminate the right hand path after sending my email so to do that I can add.

    An action at the bottom of it the action is in the control group it's called terminate and it will have three possible statuses failed canceled or succeeded.

    If I choose failed I could fill in an error code and a message and presumably something could pick up on this but I would argue it's actually succeeded it's successfully found there's a discrepancy.

    In the number of files and sent me an email and all I want to do is make sure it doesn't carry on and run the rest of the flow and terminate will do that so let's see.

    If this has worked if I now try running this so save and test it and then when it appears if I click on the Run flow button.

    Then when I look at the output of this you should see that that was the condition being executed that's what that strange orange symbol was for which took me by surprise.

    You can see that it hasn't run the compose action I may need to just zoom in on this so you can see it there's a black cross so it went down the right on path three.

    To the terminate State terminate statement and then stopped so for the sake of completeness I'm now going to prove that this works if I go down the left hand path I don't want you.

    Thinking I'm fiddling things so I'm going to go to my SharePoint uh drive and so could you and we'll delete the lasagna file so you've now got two files in the same.

    In each of the two folders actually they're different the OneDrive contains lasagna the power sorry the SharePoint one contains veggie chili proving what a useless flow this is but hopefully it's.

    Useful for teaching power automate if I test this I won't actually see whether it's gone down the yes path I won't see an icon here so I'm going to do just to make things Crystal Clear is.

    Add a cheeky little compose action on the left hand side which will just say the word test so that's just for debugging purposes so I can clearly see that it's gone down the left hand path.

    So if I now try running this save and test and then when it appears if I click on the Run flow button and then done and have a look at the output from it.

    You can see that if I expand the condition it's gone down the left-hand path the icons on the right show that it never went down this path the one on the left showed it did go down this side and.

    It went on and finished and ran the compose action at the bottom so it really was working so it's the final part of this tutorial I want to show you an alternative to.

    Using a condition which is using the more flexible switch statement although whether it's a good thing to do is uh we'll we'll see so I've rewounded the clock back to the.

    Beginning of the tutorial and I'm going to add a new Step at the bottom which instead of using a condition from the control set of actions uses a switch statement instead.

    And the idea behind this is I can test a value here and see whether it's 0 1 2 Etc so what I'm thinking is if the number of files difference between OneDrive and SharePoint is zero I'll do.

    Nothing if it's one I'll send a slightly worried email if it's two I'll send a panic email and anything more than that I'll send a distraught email so the first thing I need to do is put.

    My expression in here and as we'll see this actually isn't as simple as you may think so what I'm going to do is put the OneDrive file count and I'm going to.

    Subtract from that the SharePoint recipe count and that should give me the difference between the two files if it's zero I'll do one thing.

    But I also want to add another condition so I'm going to click on this plus to add a case in and if it's one I'll do something else and maybe if it's two I'll do something else and here you see.

    The limitations of the switch function it's almost impossible to display visually the more actions or more cases I type in or add The Wider I'll have to scroll to.

    See them all and it just completely distorts your view and there doesn't seem to be much you can do about this so I'm actually going to delete that third case I just added to revert back.

    To where I was with just two cases you can't delete the default statement which is a good thing in my opinion you always have to have an else statement of what happens if the other conditions aren't.

    True so now what I could do is I could add a step at the bottom here and what I'm going to do is add a compose action just to prove that it's gone on to the.

    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=pOSai63-OQE
Postagem Anterior Próxima Postagem