Hello. So let's now implement the Insert button. So, insert button again what it will do, it will get the value from this two input text, and it will insert the row in this table and it leaves a two input text. So, this is the action listener from this button. So, the first thing we get the value, so I will call object you will see object ID equal how I will get the value from this in verticals. As I told you we point this in particular in the bag bean with dipped ID component property.
So, I will get system ID component and the gate value. So, I will say get the ID component don't get it Same for the name, but I would get from the name component to get a value. So, I now get this value. So what should I do after that I should insert this value in this table which is programmatic department if you want how I can insert this you have to follow some steps. First, let's go to the binding. First I need to go to this pointing.
After that, I will need to get this a traitor. And for my traitor I will get the view object. And after I get the view object, I can insert zero. So I need to do this three step, get binding. Get a traitor gives a view object and offer That I will insert the row in the programmatic department ID. So, to get the binding we will create here a private method who gets a binding here, this is the method this method I call it gets a binding and it is buying the Kentucky's getting current direct current pointing entry.
So, this is the method will get returned the binding once I get the binding reach to the binding I can get a traitor and they can get a new operation here if I want I can do anything in sub binding. Okay, so what I need to get after the binding I need to get the iterator to get the iterator from the beach definition or from the binding we can call the C e traitor binding iterator equal get it binding we will get it from the binding so we will stick to the binding dot get and we will sit here citrate or name. So, you will get a Twitter ID here you will find here this is my Twitter ID I will get it and you will put it here then I will just cost so, I would put here so this is the way I get now the iterator from the PG definition and from the iterator I said I need to get the view object.
Okay how you can do that you will define the here for you. Object people equal a traitor to get a few options. Okay, good. So we get to the view object once we reach to the view object we can insert throw in sighs this view object. So we will define here for our equal vo dot create. Create row.
Now we will create this row, this row of Oracle the GPO to throw work into GP auto Pro. So you should insert Oracle the GPO to throw in bought or conditional throw. So now we define the row a, we create a new row from in this V object we create a bureau we create a row after that we need to set the value of this row. So you can write or to set attribute with some value or to set attribute drop to attribute in this programmatic we have to attribute default divert. It is wrong mistake no problem. They were ID should be department ID okay and the other one is department name which value I will set the department ID it will set from this and here okay.
Okay, so again we get so binding from the by Nick we get a traitor from a traitor we get the view object from the view object we carry through and we sit attribute of this row with the value from the input text. After that we will insert this phone size of the object so we will call vo dot insert row and I will give zero. This is how we get the value from the input text and insert row four In that programmatic view object after that we need to clear the input text. So what you can do we can say just get it dipped ID component we need to get the component to set a value sit there you know, okay. Same we will do in the department name. This is what actually is the Insert button will do.
So this is insert button, it will read the value, read the value from the input text, insert it here and clear the value. So, this bottom now is done. The second thing we'll do is the Save button. So simple to let's first add an action listener in the background. So I will coherence action listener and I will edit and create see if the action is okay, this is the function, which once I receive our globe over this programmatic view object and I should insert as a department into the department table. Okay, so now I need to loop over the programmatic table and get row by row to get the department one by one which is a user inserted and after set I need to insert it to the database.
So first I need to get a traitor so seemed like we did here I need to get some programmatic a traitor We'll be here and after that I need to loop over zero of this iterator so I will write here for i equals zero and I miss an iterator okay you object to get estimated row count, so I will go row programmatic row equal a traitor true range index of I. Okay. So now I will loop over the iterator and I will get row by row. Okay once I get zero is a finished row in the programmatic or row by row What should I do how I will insert this value in the database. I have a good idea to do this we can find method IDs application module and we will we will create a client method and we can call this client missile here and send the department ID and department name to this method and this method will insert it.
So, I will open the application module I will go to Java here and I will generate an application which will image loss after that I need to create a method here which will receive the department ID and department name and it searched it into the database. Anyway we have here one, the department view object. It is not programmatic it is a department view object which is based ones entity we can insert row here and we will and this view will map to the entity and entity map to the table and it will insert the row to the table. So, I will get this bottom interview one instance and I will start creating the row in this instance. So, I will create here public void insert the to database and this function will accept integral dept ID string the 22 will accept two parameters, the ID and the name after that what I should do I need to call the department if you want I can get it from here because in a way I am this application module.
So, I will get the view object deep VO equal it hit the bottom interview one okay now I get to the bottom interview one I will do the same what I did in back been I would carry through and I will sit attributes in I will insert the row to the view object. So I will see row or equal it V oh don't carry it carry through then I will here it should be Oracle two GB ultra Oracle GB Oh rule then I will say our set attribute okay we now we can carry through in the department if you want so let's go to the department to view attribute I need to set a department ID With the department ID which the user will send. Here I will set the second attribute which is a department name. And we'll set it was the department name which the user will send.
After that I was in, I would insert this role and size of objects where you get the view of you insert row. So this is just a simple method will receive department ID department name and once the user quality Smith and send the parameters department ID and department name, the method will get the department if you want and create new row and seats attribute then it will insert the row to the view object. This is what actually is function will do. After we create this lettuce edit as a client interface. So that I can be able to call it from SAP XP okay. So, now, it should appear here it is appear here.
Now, if you want to call this method in the back pain here you have to add it in the budget and finish first. So, I will go through the budget dimension because any anything you want to call it in the back pain you have to add it in the budget finish otherwise you will get no pointer exception. So, here I will add method action. So, I will go to the beach definition in the binding, I will add method action and I will select the this method and a breeze Okay, so, this episode now incites a binding so I can easily Hold this method in the back up. So let's see back again to the back be now and I need to call this method. So I will create here private method, private void call in method binding, okay.
And you should send object ID object name here I need to call this missile to do that we can call operation binding will be equal, you will have to get it from the guitar binding So, you have to call get a binding. Get it binding don't get it operation binding Do you give the name of the operation This is you'll give it here okay. So, now we connect to the binding, then I said gets operation pointing and the gives idea of the method. After that I need to set a parameter you have to call get it by, get it operation binding dot get barometer map dot put here we need to get the parameter name and we can set the value. So as a parameter name from where you can get it in the budget definition itself once you add the method here in the structure, if you expand it, you will find the parameter so you can get the first name ID Type is integer.
So, let us let us put department ID integer dot parse integer, the department ID Okay. We'll do the same ob to get parameter map put we will add the second one which is the name and we will sit string dot value of dipti. After we set the parameter you can execute by operation dot execute. Okay, so this is now how we can call the missiles from budget Finishing first we as a method individually finishing second we get the binding and from the binding we get it. After that we set a parameter and we press execute. Okay, so now once we loop over the programmatic view object and I need read it read row by row, you need to get the department ID department name from the programmatic view object and call dismissal.
So I will call this method and I need to set the department up since department ID and department name from the row. So I will I grow the get attribute and we will give attribute name here again, roll to get attribute and we take this is a tribute Nunes a programmatic and this is a new So now once he was a brace on the Save button, what actually this will do, it will loop over the programmatic view object and get row by row from this programmatic view object. After that I will call the missile binding and I sent the department ID department name from Cisco. And this, of course, will insert the value we'll call the method from the application module and application module inserted in the view object. After this loop is finished, we need to commit the changes. So, to commit the changes, you have to you should have a commit operation in the binding.
So the first step is to add commit action here. So I will add new action and I will bring to the commit operation. So the commit here exist in the binding in that case, I can call it Columns a bag B, you can call the operation action same like the method. So you can get this operation pointing and instead of a method name you can add the operation name which is commit Zen will be to execute. Okay after after I execute I need to clear the programmatic view option to cleaves the programmatic the object simply gets a view object and write execute query. So forms a traitor, get the object dot execute query because there is no actually query behind this programmatic view object.
This is why it will clear all that from the table. This is how you can loop over there programmatic table, iterator and the column method binding. And after the finish, you can commit the change and execute query to clear the table. This is what the Save button will do. So let's see if we can do is we can add a bunch of triggers what once you've received we need to refresh this so I will take p3 and bring to refresh the whole because this table should be clear after you business. So actually need to refresh the table, I can refresh the master or the parent component and it will automatically refresh the table.
Same as insert Once I press insert, it will refresh this table and refresh this. So I can easily refresh the mean parents, which is a benefit group with this Okay, so let's now try to run and see which one Okay, so as you can see here there are department I eat workmen name and this is insert bottom and this is programmatic table and this is a sip. So, let's try to test I will add one dip to one and the prison cert so it is inserted here and the text is killing it as you can see. So this is a to do to insert this coming here okay 3 million data insert coming here if I need to remove this, I will delete okay this is something we can fix. We need that lipo to skip this validation and I think the Save as well. We will receive Yes, so I need save and delete skip this require code we mark this in both tickets as required.
So, any actions that is a beach it will fire this. So you can easily escape this validation when you press Delete by sitting immediate is a behavior you will find here immediate city okay and same in the same I will sit in imitate true okay like this. So let us refresh it again okay so this now this department it will delete if you're happy you can press save. Now which is gone. This shakes database departments Krish we should see two departments one and two. Yes, here one and two is insert as you can see three or see if you will find it here.
So this is how you can use the programmatic view object to display some data at runtime. And this data is not belong to any query or not belong to any database level by adding this programmatic view, view as a table or as a former table, and you can easily insert and delete CRO insight from this programmatic free auction. So this is a more grammatically object because the video will go for Another feature so see you next activity