 Welcome to SSUnitech social disk site and this is continuation of area tutorial. So in the last video of this video series, we have discussed about the set variable activities and today we are going to start with the if condition activity. So if you haven't watched last two videos of this video series, so I would strongly recommend to watch that video. So this is the continuation of that video. So first we have discussed about lookup activity and after that we have discussed about the set variable activity. So what is the if condition? So the if condition activity provides the same functionality that and if statements provide in the programming languages. So like in the programming languages, we are having one condition and if condition is satisfied, then we are having one block for the true and another block for the false. So if that condition is satisfied, then it will be going to execute your true block and if condition is false, then it will be executing your false block. So such type of conditions we have already seen in the programming languages. So similarly here we are having this if condition activity. So it execute a set of activity when the condition evaluates to true. As I told you, if this condition is satisfied with true, then your true block will be executed and another set of activity when condition evaluates to false. The same thing if this condition will be failed, then your false block will be executing. So how we can use this in our real time environment. So go to on the browser and we'll try to understand the requirement. So here if you have remember first we are having the lookup activity then set variable activity inside the SQL server, we are having one of the source and on that source we have one column that is the refresh date. So as per the requirement if the refresh date column value is more than the current month's first date. So for example, here it is 26th of May and this is 4th of April. So this condition is not going to satisfy. So your false block will be executing we'll see later in this video. So as per the condition if this will be satisfying the condition then data should be loaded from this table to another DB and here is the table. So we just want to dump the data from here to there but the condition is for the refresh date. So for that we have already get the refresh date from this lookup activity and after that we have declared a variable where we have set the value of the refresh date. So let me try to debug it quickly and I will show you that. So it got executed successfully. If we can check the output of the refresh date then we can see the last refresh date which is the 4th of April as we have already seen inside the SQL server. So this is the format that you have remember like we have to use the same format in our if condition. So let me close this and here let me drag and drop the if condition from this activity. So this is the if condition and this would be connected after this set variable. So under this if condition first we are checking if the variable which is refresh date that value is greater than current month's first date. So how we can do that? For that here we can rename this to checking refresh date. Go to the activity here we can see the expression. So we are more concerned how we can write the expression. So we can click on that and add dynamic content we can click on here. So for writing the expression I will be recording a detailed video how we can write the expression here but as of now you only understand we have to check if your refresh date value is more than the current month's first date. So for that we have to write the greater the first one we have to specify two parameters. So it will be checking the first parameter and the second parameter. So first parameter value that is coming from the variable which is the last refresh date. Click on here and let me put on comma. If you have remember then this last refresh date we have some format that we have already seen the output of the set variable activity. Now here we have to calculate the current month's first date. So how we can do that? So for that the first thing we have to get the current month today's date. So that will be the UTC now. Here we have to open the parenthesis and close that. So this will be going to check for the today's date but that is not the case. The case to check the first date of current month. So how we can do that? So we have a function that is start of month like this and like that. So it will be going to get the current month first date. Now the format that will be the same as we have already seen the format inside the variable that will be having the values up to decimal places. So similarly here we have to use the format function. So how we can do the formatting of this? So we have to use the format date time function. So this will be formatting your string value. So this would be the format date time. Now here we have to specify on which format we want to do the formatting of this date. So that is your year first then month then day after that we have to specify our minute and seconds and here let me close the parenthesis. So everything looks good. So what it is doing? So first it is going to check the greater of this refresh date. So this refresh date value should be greater than this equation and as per this equation first we are going to get the today's date by using this UTC now and after that we are going to get the start of this month. So that will be the first day of current month. So in our case that will be first of May and after that we are doing the formatting of this the same format as we have already inside this variable. So this is done now we can click on OK. So if condition is completed next if condition will be satisfying then what we want to do? So here we can see we have true and false. So inside the true we can add the activities and inside the false we can add the activities. So for the true let me click on here and we just want to copy the data from one location to another location. So we can use the copy data activity go to other source and inside the source we have to select the data set. So as we have already created the data set so let me try to get that one. So this is a data set which is pointing the SSU database inside our SQL server. So this is the same thing like here we have these four rows we can confirm from here by using this preview data option so you can click on that. So as we can see we are having these four rows there. So this is for the source similarly we can do for the sync as we have already created that. So this is for the sync and here everything is ok we can go on the mapping and import the schema so we can just verify that we have only four columns and those should be matching. So as we can see all these are matching so everything looks good. Now here let me try to publish this and click on publish so it is deploying the changes. Now publish is completed go back to the if condition and here let me try to debug it. So once we are going to execute this so as we have already seen in our database we are having the data for the last month so the refresh date is indicating for the last month. So this copy data activity should not be executed so we can check. So it is executed successfully but if we can go here then this copy data activity did not executed or we can also verify from this output like here. If condition is executed set variable executed look of activity is executed but copy data did not executed. So go back to the SQL server let me try to update this refresh date and this time this refresh date will be indicating for the current month fourth of the month. So let me try to check it here so everything is updated that looks good. Now go back to the Azure data factory and try to debug it again. So this time your copy data should be executed and data should be loaded inside the destination. So we can wait so it is executing so now here we can see copy data is executing so it is loading the data into the destination site so let me refresh it. So copy data is completed so your if condition will be completing soon. So everything is executed successfully now go back to the SQL server and we will try to refresh the table by pressing Ctrl R and we will be having all those four rows here. So that we can see all the data that is loaded successfully in our destination table. So this is the use of the if condition as the same thing we have not discussed yet how we can send the email or the notification so in the false part I will be going to cover how we can send the emails in the later of this video series we can set up the false if your data is not updated then we can send the email to the source team by which we are getting the data like your data is not updated for this month so such type of email we can send inside this false block so I hope guys you have a better understanding about the if condition if you have still any doubt then you can comment your questions in the comment section I will try to response there thank you so much for watching this video if you really like this video please subscribe our channel to get many more videos don't forget to press the bell icon to get the notification of our newly uploaded videos see you in the next video