 Hello, welcome to SSUnitex to see this side and this is continuation of Azure Databricks tutorial. So today we are going to see about the Widget Utilities. So what is the Widget Utility? So that we will see. So basically Widget Utility is very important and it will allow us to create the parameters inside the notebook. So we have not seen how we can create the parameters and we will be reading the data from that parameters. So by using this utility we can implement. So here inside the commands as we can see we are having few of the important commands like combo box, drop down, text and multi-select. So these four commands will be going to use for creating the parameters. And by using the get and get argument we will be reading the parameter values. And by using the remove we will be removing the these four commands parameters if those are available in the notebook. So let's start with one by one. So first go with the combo box. Let me quickly go inside the browser. And here first let me try to use the dbutils.help. So inside the help we will be seeing about these are the available methods. So here we can see this Widget. So let me try to use the Widget here and execute it. So under this we can see we are having the combo box, drop down, get, get argument, multi-select, remove, remove all and text. So all these commands we will be covering in this video. So let's go with the first one which is the combo box and try to see about combo box. Combo box will be taking the parameter that we can see as name. Then we can pass the default value of that. And after that we can also provide the choices. And then we can see the level. So like it will be having four input parameters, first is the name of the combo box, second will be the default value, third will be the choices as in combo box, fourth will be the level. So let me try to create the first Widget utility parameter. So here we can use the dbutils.widget, . we can use the combo box. The first parameter is the name. So let me call like country and after that we can call this as combo box for cp. So this will be your parameter name, second we can see the default value. So we can pass the default value as in India. So it will be having India. Now third parameter will be the choices. So inside the choices we can add the choices something, first choice as in India, inside the second choice that could be US, third choice that could be Pakistan, fourth choice that could be UK and last we will be specifying the label. So label what it is going to display. So I just want to display this as country combo box. Let me try to execute it. So we should be seeing this input parameter and in this combo box as we can see India and that is by default selected and all these four is available in this values. So this country cb is label. So let me try to delete this first. And here we can see the label name that is the country cb. If you are going to specify underscore then this will be with the underscore. If the default value is India then all these choices is available. So by using this we can create the combo box. Similarly we can also create the another parameter for the drop down. So let me try to see dbutils.withget.help here we have seen about the combo box. This time we want to see about the drop down. So let me use the drop down as an input parameter of the help. So it will be displaying about the description of this. So here we can say it is again asking about the name of the drop down then the default value then the choices then the label. So the same thing that we have seen inside the combo box will be available inside the drop down as well. So let me try to use the dbutils so dbutils.withget. Now we can see the drop down. So we can use this command drop down first will be the input parameter name. So this for the drop downs I am going to call this as country drop down. So this is the name second we can see the default value. So default value again I am going to pass as an India then we can see the choices. So inside the choices we can have the choices something India first. Next choice we can have Sri Lanka. Next choice we have Australia and last choice could be New Zealand. Now last parameter for the level so I want to display the level of this as country drop down. Let me try to execute and we will be seeing two input parameters. So here we can see the drop down of the country. So again it will be having all four values that we can see New Zealand Australia India and Sri Lanka. So this is for the drop down. Now let me try to go and see for the another one that is multi select. So let me try to execute this help command and here we can see the multi select. So let me try to see the description of the multi select. So it will be going to execute and here we will be seeing again it is asking the same thing like the name default value choices and the level. So like all these four parameters are same for these three we get commands. So let me try to use the DB utils dot with get dot multi select. Now first is the name of the parameter. So I am going to call this as country multi select. Next we can see the default value so I am going to pass as an India. Next inside the choices so I am going to use the India. Next I am going to use the Pakistan. Next I am going to use the Australia. Next I am going to use the South Africa. So these are the choices and the level I want to use the level of this multi select as country multi select. Let me try to execute it. So this time we can see we are having this country multi select and while we are selecting so it will be multi selecting values like all these. Now let me try to unselect so this is for the multi select. Now let me try to check the last one which is the text. So what that will be doing? So let me try to execute this help command first and inside the help command let me scroll in the downside. So this is the text command. So the text command is having the name default value and level remember other three commands are having the same four input parameters but in case of the text it will not be having any choice. Choice means default values we are not having. So that's why we can see the choices is not available in case of the text. So similarly we can also use the DB utils dot with gets dot text. The first parameter as we can see the name. So I am going to call this as country and this is for the text. So I am going to use the txt next parameter is the default value. So I am going to use the default value as in Australia this time. Next here we can see the label. So inside the label I am going to call this country text. Let me try to execute. We will be having four input parameters. So this is for the drop down. This is for the multi select. This is for the country text by default is Australia and this is for the combo box as we can see. So you can remember very easily like accept text other three are having four input parameters choices default value name and label and the text will not be having choices that is understood. We should not be providing the choices here and that should not be available. So that is why we cannot add the choices. So this is all about the commands for creating the parameters. Now the next question will come in the mind how we can read all these parameter values. So for reading the parameter values here we can see the two commands for the get and get argument. So let me try to use these two first and then we will see the difference. So for reading values from the parameter let me use the dbutils.withgets. Here we need to supply the get command and under the get command we can see we are having this drop down. So let me try to access the values of this drop down. So inside the get command here we can supply the name of the parameter. So the name of the parameter remember for the drop down we are supplying something like country dd. So we can copy this and the same name we can use under the get. Let me try to execute it. As we can see India because we have selected India. So if we will select New Zealand automatically it will be executing and we will see the New Zealand. So we are not required to execute manually these cells once we are making the changes on the parameters it will be executed automatically if we are accessing those parameters inside the cell. Now let me try to use for the multi-select. So instead of the dd we can simply use the multi-select and try to execute. We will see the Pakistan as we can see. If we are going to select the multiple values like the Pakistan and India then that will be appearing by using an string with the comma separated values. If we are going to select South Africa then it will be having three values with the comma separated Pakistan, India and South Africa. In the last one we can also use the combo box. So we can simply pass the name of the combo box parameter and we will see India. And similarly for the text of the country so for the text box we can see Australia. If we are going to pass any another value in Pakistan and once we tab it will automatically executed and we will see the Pakistan. So the same thing we can also achieve by using the get argument command. So let me try to use the get argument command and quickly show you it will be returning the same output. We will see the Pakistan here and if we are going to check for the multi-select then we will be seeing Pakistan, India and South Africa. If we are going to see for the drop down we will see Sri Lanka for sure and for the combo box we will see India. So that we can see India. Then what is the difference? Difference is we can also pass one more parameter on the get argument and that parameter if this name is not available like your parameter is not available then instead of throwing an error this time quickly show you let me try to remove this and execute it. So it will be going to throw an error and it is saying like there is no any with get available with this name and we don't want to throw an error. So by using the get command it will always throw an error but in case of the get argument command we can simply say like the error parameter is not available. Something like that we want to display. Let me try to execute and we will see. So this time what it is reflecting it is not throwing an error. It is reflecting what we have specified in the second parameter. If your value parameter is not available. If we are passing the correct one then we should be seeing the value as an India and if we are not passing the correct one and it will be reflecting the second parameter. So this is something like the case statement. If this is available then it will return that value. If it is not then it will be returning this value. Now we have done with the get and get argument. Let me quickly show you about the remove. So remove is going to use for removing the parameter inside the notebook. So simply we can use the dbutils.withgets.remove then we can simply pass the name. So again we can pass the name of the parameter. So I am going to remove the combo box. You can see the combo box is available. Once we will be executing this the combo box is gone. That you can see the combo box is not there. Now the last one we want to remove all the parameters. So how we can do that? Simply instead of using one by one we can remove the input parameter and we can use the remove all and we can execute and all these parameters should gone. So it is throwing an error because we have to use all as in caps. So that we can see error has been gone. So this is all about the withget utility. One thing that you have noticed we are passing the choices as an static value. But in the real time this option should not be there. We should be getting these values from any table. So how we can use that table and this will be going to pass as an dynamic we will see in the next video. And we can also create all these withget by using the SQL. So in the next video we will be going to see how we can create all these withget utility commands by using the SQL and second we will see how we can pass choices as an dynamic. So thank you so much for watching this video see you in the next video.