Thursday 28 March 2013

Copying Data From One Table to Another Table in OAF and ADF Using RowsetIterator

 
Requirement:Copy FirstName,LastName,EmployeeId  to Sample Table(Custom)

Step1:Create Sample Table  wihch Having Fileds Like FirstName and Last Name and EmployeeId
     Step 2:Create New View Object For this Sample Table.

Add Below Code in AM Impl

public void Rowcount()
    {
        ViewObjectImpl vo = getEmployeesVO1();
        RowSetIterator rs = vo.createRowSetIterator("xxx");
        while (rs.hasNext())
        {
        
           int rowcount=vo.getRowCount();
           Row row=rs.next();          
           ViewObjectImpl newvo=getSampleVO1();
            Row row1=newvo.createRow();           
            newvo.insertRow(row1);
            row1.setAttribute("EmployeeId", row.getAttribute("EmployeeId"));
            row1.setAttribute("FirstName", row.getAttribute("FirstName"));
            row1.setAttribute("LastName", row.getAttribute("LastName"));

          getDBTransaction().commit();  
              }
    }

1 comment: