Insert and DoInsert
Step 1:- create the Table(InsertOperations) with fields(AcNo,Name,City,PhoneNo,EmailId)Step 2:- Take One new job and insert the data into created table through X++ coding
Static void InsertOperatations(Args _args)
{
InsertOperatations insertoperatations;
Insertoperatations.AcNo=”1”;
Insertoperatations.Name=”A”;
Insertoperatations.City =”Hyd”;
Insertoperatations.PhoneNo=”1234567890”;
Insertoperatations.Email=”a@gmail.com”;
Insertoperatations.insert();
}
Before Insert open the table.
Step 3:- Now we override the method insert. Go to the table-> expand the + button-> find the methods node -> Rightclick on methods node ->override-> insert writhe the following code. This.city=”HYD”; Super(); Now the above job you’ve to change the data as well as different city also. Suppose you are giving any city but It insert the data only HYD. Bcoz you are override the method is Insert. Imp:- before super only we’ve to give the default value of country.
Step 4:- Now we are try to insert 2nd record And open the table and check the Data. DOINSERT
Step 5:- use the command do Insert. Just replace the instead of insert to doinsert. Static void InsertOperatations(Args _args) { InsertOperatations insertoperatations; ; Insertoperatations.AcNo=”1”; Insertoperatations.Name=”A”; Insertoperatations.City =”Hyd”; Insertoperatations.PhoneNo=”1234567890”; Insertoperatations.Email=”a@gmail.com”; Insertoperatations.doinsert(); } Check overridden insert method also Now open the table and check the data. Bcoz the doinsert method bypass the insert method. It is what ever we want give the data it bypass the insertmethod and push the data into Table.
Video Tutorial Of this Post
No comments:
Post a Comment