 Hello everyone and welcome back to another video. So I had today's video topic asked as a question before and I also thought it was a good one to cover off anyway. So we'll be looking at power automate but this time how to store values as variables. So the particular scenario is say you want to use today's date. What you can do is you can obviously do an expression every time you wish to use today's date and obviously format it as you require. But a much easier way to do that is to calculate it once, store it as a variable and then obviously you can recall that value anytime you wish. So to demonstrate this example we're using a simple flow we've done in a previous video which was to send an email every time a new file is added to SharePoint. So if you haven't seen that video there'll be a link to it on the screen somewhere now but if you have seen the video then obviously we'll be carrying on from where we left off. So in that flow we only had the two steps the acknowledge a new file being added to SharePoint and then the outlook to send the email. All we're going to do is and you can do this at any point but I'm simply going to add an action in between these two current ones so go to add action and simply all we're going to search here is the word variable and you can see there's many different options we have for managing and updating our variables but the one I'm going to go with is I'm simply going to select variable here so we can filter to all of our options and the particular the one we want is initialize variable so you can sometimes like defaultly think set variable is what you want but when we're trying to set a brand new variable then we want to use initialize variable and you'll get the three options here. So the first thing you do is name your variable what you want to call it so for me I'm going to call it current date but of course you can call that whatever you wish and then we need to define what the value is so which is obviously the type what is the data of this value so for me I'm just going to simply use string because that will work perfectly and it's now in this value section here where I can you know perform the expression to store that variable so for me I'm going to go to the expression tab and I'm simply going to type the word format date time open brackets I'll then use utc now to get the current date as of now I'll do a comma and then within a single quote I'm going to do locate double d slash mm slash year and then what this will do it will get the utc now so it'll get me the current date and time but then obviously by formatting the date time it's only going to return the date in this desired format so you may have used seen me use this exact expression before when we were doing this this video earlier to try and get today's date but obviously by what we're going to do now is store it as a variable so we only have to perform the calculation once so we'll click okay and you can see it stored as format date time so we can now go into our send email option here and scroll down slightly you can see at the moment we'd set this up so we've got some information about the file that's been added and then in the subject line we've got new file added so obviously just to let someone know what the subject is what I want to do though is leave new file and added with a space at the end and simply all I'm going to do is add this date we've added or calculated here all I need to do is once I've clicked in here you can see we've got our dynamic content box and we've now got this new section called variables of which one of them is called current date so if I select that like that it's now going to present to us or in search shall I say the date that we calculated in this previous step the brilliance of this is should we want to use that anywhere else so let's say in our actual email body down here we also want to include that current date as well all we need to do again is call that variable and we've now got it and we can use it as many times as we wish alternatively if you're using the power automate desktop version of power automate you can achieve the same thing simply by using some slightly different criteria so if we were to look in all of our available actions you'll see there is an option for date time as you can see now on the left hand side so all you need to do is you select date time you can simply drag the current bit current date time into your name here for us we're using current date so you could go date only set your time zone if you wish and you can see now here we've got the option of our variable so by default the desktop version will automatically store this forward as a variable for you but it gives us the flexibility that we can get rid of the word time and then we can define exactly what we want that to be stored as so once that's added in there let's just go and see if we can find an email go send email and in a similar fashion to our previous example in the office.com version of power automate if we go into our subject line all we need to do is select the variable option down the side here select our current day and select and then of course all we need to do now is just add our desired text either side of this variable so let's just do a demonstration having added this in here so we'll go into save our flow you can see it's now saving and then now it's done we'll go into test manually go test and you can see it's now waiting for us to perform the trigger action which is add a new file to SharePoint so I'll go to that SharePoint list here I'm going to do a cheat and just go into create a new Excel workbook what you can see that is now doing for us here so there's the book it's been created so if you close this tab we can see we've got our new book here we'll then go into our email inbox and we can see we've got a new email dated today so if I click onto that we can now see our subject says new file added and we've got today's date as desired and of course we've got all our content as we had and if you haven't seen our previous video it's really worth watching because we also demonstrate how you can include links such as this so that when you click that link you are taken to that newly added document so I hope you enjoyed that video if you did could you please give the video a like it's not only greatly appreciated by me but it does help that all-important YouTube algorithm and to ensure that others are able to find this video if this is the first time watching on our videos or you've watched them in the past and you're still yet to subscribe could I also please once again ask you to hit that subscribe button and also the bell notification item item bell notification button so you're notified of all of our future videos as well so once again thank you very much for watching and we'll see you in the next video